@@ -114,7 +114,7 @@ for FT in (:OffsetArray, :OffsetVector, :OffsetMatrix)
114
114
indsN = _uncolonindices (A, _expandCartesianIndices (inds))
115
115
$ FT (A, indsN)
116
116
end
117
- @eval $ FT (A:: AbstractArray{T} , inds... ) where {T, N} = $ FT (A, inds)
117
+ @eval $ FT (A:: AbstractArray{T} , inds:: Vararg{OffsetAxis,N} ) where {T, N} = $ FT (A, inds)
118
118
end
119
119
120
120
# array initialization
@@ -128,15 +128,15 @@ function OffsetArray{T, N}(init::ArrayInitializer, inds::NTuple{NT, Union{Offset
128
128
length (indsN) == N || throw (DimensionMismatch (" The number of offsets $(length (indsN)) should equal ndims(A) = $N " ))
129
129
OffsetArray {T, N} (init, indsN)
130
130
end
131
- OffsetArray {T,N} (init:: ArrayInitializer , inds... ) where {T,N} = OffsetArray {T,N} (init, inds)
131
+ OffsetArray {T,N} (init:: ArrayInitializer , inds:: Union{OffsetAxisKnownLength, CartesianIndices} ...) where {T,N} = OffsetArray {T,N} (init, inds)
132
132
133
133
OffsetArray {T} (init:: ArrayInitializer , inds:: NTuple{N, OffsetAxisKnownLength} ) where {T,N} = OffsetArray {T,N} (init, inds)
134
134
function OffsetArray {T} (init:: ArrayInitializer , inds:: NTuple{N, Union{OffsetAxisKnownLength, CartesianIndices}} ) where {T, N}
135
135
# N is probably not the actual dimension of the array; CartesianIndices might contain multiple dimensions
136
136
indsN = _expandCartesianIndices (inds)
137
137
OffsetArray {T, length(indsN)} (init, indsN)
138
138
end
139
- OffsetArray {T} (init:: ArrayInitializer , inds... ) where {T} = OffsetArray {T} (init, inds)
139
+ OffsetArray {T} (init:: ArrayInitializer , inds:: Union{OffsetAxisKnownLength, CartesianIndices} ...) where {T} = OffsetArray {T} (init, inds)
140
140
141
141
Base. IndexStyle (:: Type{OA} ) where {OA<: OffsetArray } = IndexStyle (parenttype (OA))
142
142
parenttype (:: Type{OffsetArray{T,N,AA}} ) where {T,N,AA} = AA
0 commit comments