@@ -190,13 +190,22 @@ Return `true` if the specified `indexes` are in bounds for the given `array`. Su
190
190
`AbstractArray` should specialize this method if they need to provide custom bounds checking
191
191
behaviors.
192
192
"""
193
+ function checkbounds (:: Type{Bool} , A:: AbstractArray , i:: Integer )
194
+ @_inline_meta
195
+ checkindex (Bool, linearindices (A), i)
196
+ end
197
+ function checkbounds {T} (:: Type{Bool} , A:: Union{Array{T,1},Range{T}} , i:: Integer )
198
+ @_inline_meta
199
+ (1 <= i) & (i <= length (A))
200
+ end
201
+ function checkbounds (:: Type{Bool} , A:: AbstractArray , I:: AbstractArray{Bool} )
202
+ @_inline_meta
203
+ checkbounds_logical (A, I)
204
+ end
193
205
function checkbounds (:: Type{Bool} , A:: AbstractArray , I... )
194
206
@_inline_meta
195
- _chkbounds (A , I... )
207
+ checkbounds_indices ( indices (A) , I)
196
208
end
197
- _chkbounds (A:: AbstractArray , i:: Integer ) = (@_inline_meta ; checkindex (Bool, linearindices (A), i))
198
- _chkbounds (A:: AbstractArray , I:: AbstractArray{Bool} ) = (@_inline_meta ; checkbounds_logical (A, I))
199
- _chkbounds (A:: AbstractArray , I... ) = (@_inline_meta ; checkbounds_indices (indices (A), I))
200
209
201
210
checkbounds_indices (:: Tuple{} , :: Tuple{} ) = true
202
211
checkbounds_indices (:: Tuple{} , I:: Tuple{Any} ) = (@_inline_meta ; checkindex (Bool, 1 : 1 , I[1 ]))
0 commit comments