@@ -350,16 +350,17 @@ map(c -> c[I...], Tuple(cols))
350350end
351351@inline get_ith (:: Tuple{} , I... ) = ()
352352
353- Base. @propagate_inbounds function Base. getindex (x:: StructArray{T, <:Any, <:Any, CartesianIndex{N}} , I:: Vararg{Int, N} ) where {T, N}
353+ Base. @propagate_inbounds Base. getindex (x:: StructArray , I... ) = _getindex (x, to_indices (x, I)... )
354+
355+ Base. @propagate_inbounds function _getindex (x:: StructArray{T} , I:: Vararg{Int} ) where {T}
354356 cols = components (x)
355357 @boundscheck checkbounds (x, I... )
356358 return createinstance (T, get_ith (cols, I... )... )
357359end
358360
359- Base. @propagate_inbounds function Base. getindex (x:: StructArray{T, <:Any, <:Any, Int} , I:: Int ) where {T}
360- cols = components (x)
361- @boundscheck checkbounds (x, I)
362- return createinstance (T, get_ith (cols, I)... )
361+ @inline function _getindex (s:: StructArray{T} , I... ) where {T}
362+ @boundscheck checkbounds (s, I... )
363+ StructArray {T} (map (v -> @inbounds (getindex (v, I... )), components (s)))
363364end
364365
365366@inline function Base. view (s:: StructArray{T, N, C} , I... ) where {T, N, C}
0 commit comments