@@ -350,16 +350,17 @@ map(c -> c[I...], Tuple(cols))
350
350
end
351
351
@inline get_ith (:: Tuple{} , I... ) = ()
352
352
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}
354
356
cols = components (x)
355
357
@boundscheck checkbounds (x, I... )
356
358
return createinstance (T, get_ith (cols, I... )... )
357
359
end
358
360
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)))
363
364
end
364
365
365
366
@inline function Base. view (s:: StructArray{T, N, C} , I... ) where {T, N, C}
0 commit comments