@@ -126,15 +126,15 @@ function Base.similar(::Type{T}, shape::Tuple{OffsetAxis,Vararg{OffsetAxis}}) wh
126
126
end
127
127
128
128
Base. fill (v, inds:: NTuple{N, Union{Integer, AbstractUnitRange}} ) where {N} =
129
- fill! (OffsetArray (Array {typeof(v), N} (undef, map (indexlength, inds)), map (indexoffset, inds) ), v)
129
+ fill! (similar (Array{typeof (v)}, inds), v)
130
130
Base. zeros (:: Type{T} , inds:: NTuple{N, Union{Integer, AbstractUnitRange}} ) where {T, N} =
131
- fill! (OffsetArray (Array {T, N} (undef, map (indexlength, inds)), map (indexoffset, inds) ), zero (T))
131
+ fill! (similar (Array{T}, inds), zero (T))
132
132
Base. ones (:: Type{T} , inds:: NTuple{N, Union{Integer, AbstractUnitRange}} ) where {T, N} =
133
- fill! (OffsetArray (Array {T, N} (undef, map (indexlength, inds)), map (indexoffset, inds) ), one (T))
133
+ fill! (similar (Array{T}, inds), one (T))
134
134
Base. trues (inds:: NTuple{N, Union{Integer, AbstractUnitRange}} ) where {N} =
135
- fill! (OffsetArray (BitArray {N} (undef, map (indexlength, inds)), map (indexoffset, inds) ), true )
135
+ fill! (similar (BitArray, inds), true )
136
136
Base. falses (inds:: NTuple{N, Union{Integer, AbstractUnitRange}} ) where {N} =
137
- fill! (OffsetArray (BitArray {N} (undef, map (indexlength, inds)), map (indexoffset, inds) ), false )
137
+ fill! (similar (BitArray, inds), false )
138
138
139
139
# # Indexing
140
140
@@ -207,12 +207,6 @@ function Base.show(io::IO, r::OffsetRange)
207
207
end
208
208
Base. show (io:: IO , :: MIME"text/plain" , r:: OffsetRange ) = show (io, r)
209
209
210
- # ## Convenience functions ###
211
-
212
- Base. fill (x, inds:: Tuple{UnitRange,Vararg{UnitRange}} ) =
213
- fill! (OffsetArray {typeof(x)} (undef, inds), x)
214
- @inline Base. fill (x, ind1:: UnitRange , inds:: UnitRange... ) = fill (x, (ind1, inds... ))
215
-
216
210
217
211
# ## Some mutating functions defined only for OffsetVector ###
218
212
0 commit comments