@@ -102,9 +102,12 @@ Base.parent(A::ArrayOfSimilarArrays) = A.data
102
102
Base. size (A:: ArrayOfSimilarArrays{T,M,N} ) where {T,M,N} = split_tuple (size (A. data), Val {M} ())[2 ]
103
103
104
104
105
- Base. @propagate_inbounds Base. getindex (A:: ArrayOfSimilarArrays{T,M,N} , idxs:: Vararg{Integer,N} ) where {T,M,N} =
106
- view (A. data, _ncolons (Val {M} ())... , idxs... )
107
-
105
+ Base. @propagate_inbounds function Base. getindex (A:: ArrayOfSimilarArrays{T,M,N} , idxs:: Vararg{Integer,N} ) where {T,M,N}
106
+ @boundscheck checkbounds (A, idxs... )
107
+ J = Base. to_indices (A. data, (_ncolons (Val {M} ())... , idxs... ))
108
+ @boundscheck checkbounds (A. data, J... )
109
+ Base. unsafe_view (A. data, J... )
110
+ end
108
111
109
112
Base. @propagate_inbounds Base. setindex! (A:: ArrayOfSimilarArrays{T,M,N} , x:: AbstractArray{U,M} , idxs:: Vararg{Integer,N} ) where {T,M,N,U} =
110
113
setindex! (A. data, x, _ncolons (Val {M} ())... , idxs... )
@@ -174,10 +177,6 @@ VectorOfSimilarArrays(parent::AbstractArray{T,L}) where {T,L} =
174
177
@inline Base. IndexStyle (V:: VectorOfSimilarArrays ) = IndexLinear ()
175
178
176
179
177
- Base. @propagate_inbounds Base. getindex (A:: VectorOfSimilarArrays{T,M} , rng:: Union{Colon,UnitRange{<:Integer}} ) where {T,M} =
178
- VectorOfSimilarArrays (view (A. data, _ncolons (Val {M} ())... , rng))
179
-
180
-
181
180
function Base. push! (V:: VectorOfSimilarArrays{T,M} , x:: AbstractArray{U,M} ) where {T,M,U}
182
181
size (x) != Base. front (size (V. data)) && throw (DimensionMismatch (" Can't push, shape of source and elements of target is incompatible" ))
183
182
append! (V. data, x)
0 commit comments