@@ -52,11 +52,10 @@ last(b::Block) = b
5252iterate (x:: Block ) = (x, nothing )
5353iterate (x:: Block , :: Any ) = nothing
5454isempty (x:: Block ) = false
55- broadcastable (x:: Block ) = x
55+ broadcastable (x:: Block ) = Ref (x)
5656ndims (:: Type{<:Block} ) = 0
5757ndims (:: Block ) = 0
5858eltype (:: Type{B} ) where B<: Block = B
59- getindex (B:: Block , :: CartesianIndex{0} ) = B
6059
6160# The following code is taken from CartesianIndex
6261@inline (+ )(index:: Block{N} ) where {N} = Block {N} (map (+ , index. n))
@@ -147,10 +146,12 @@ struct BlockIndex{N,TI<:Tuple{Vararg{Integer,N}},Tα<:Tuple{Vararg{Integer,N}}}
147146end
148147
149148@inline BlockIndex (a:: NTuple{N,Block{1}} , b:: Tuple ) where N = BlockIndex (Int .(a), b)
149+ @inline BlockIndex (:: Tuple{} , b:: Tuple{} ) = BlockIndex {0,Tuple{},Tuple{}} ((), ())
150150
151151@inline BlockIndex (a:: Integer , b:: Integer ) = BlockIndex ((a,), (b,))
152152@inline BlockIndex (a:: Tuple , b:: Integer ) = BlockIndex (a, (b,))
153153@inline BlockIndex (a:: Integer , b:: Tuple ) = BlockIndex ((a,), b)
154+ @inline BlockIndex () = BlockIndex ((), ())
154155
155156@inline BlockIndex (a:: Block , b:: Tuple ) = BlockIndex (a. n, b)
156157@inline BlockIndex (a:: Block , b:: Integer ) = BlockIndex (a, (b,))
@@ -202,7 +203,7 @@ BlockIndexRange(block::Block{N}, inds::Vararg{AbstractUnitRange{<:Integer},N}) w
202203
203204block (R:: BlockIndexRange ) = R. block
204205
205- getindex (:: Block{0} ) = Block ()
206+ getindex (:: Block{0} ) = BlockIndex ()
206207getindex (B:: Block{N} , inds:: Vararg{Integer,N} ) where N = BlockIndex (B,inds)
207208getindex (B:: Block{N} , inds:: Vararg{AbstractUnitRange{<:Integer},N} ) where N = BlockIndexRange (B,inds)
208209getindex (B:: Block{1} , inds:: Colon ) = B
0 commit comments