Skip to content

Make isstored public #56421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,16 @@ end
size_to_strides(s, d) = (s,)
size_to_strides(s) = ()

"""
isstored(A::AbstractArray, inds...)::Bool

This is a function for testing if the array `A` stores an actual value at the index specified by `inds`,
i.e. if `A[inds...]` will look up a value from some storage, or if it gives some computed fallback value.

A result of `true` does *not* guarantee that there is truly a stored value at that index since the default
implementation of this function simply returns `true` unconditionally (or errors if out of bounds). However,
a result of `false` *is* a guarantee that there is no stored value at that index.
"""
function isstored(A::AbstractArray{<:Any,N}, I::Vararg{Integer,N}) where {N}
@boundscheck checkbounds(A, I...)
return true
Expand Down
1 change: 1 addition & 0 deletions base/public.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public
# arrays
has_offset_axes,
require_one_based_indexing,
isstored,

# collections
IteratorEltype,
Expand Down