Skip to content
Open
Changes from 2 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
8 changes: 7 additions & 1 deletion src/Lookups/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ for f in (:getindex, :view, :dotview)
@propagate_inbounds Base.$f(l::Lookup, i::Union{Int,CartesianIndex}) =
Base.$f(parent(l), i)
# AbstractArray, Colon and CartesianIndices: the lookup is rebuilt around a new parent
@propagate_inbounds Base.$f(l::Lookup, i::Union{AbstractArray,Colon}) =
@propagate_inbounds Base.$f(l::Lookup, i::Union{AbstractVector,Colon}) =
rebuild(l; data=Base.$f(parent(l), i))
@propagate_inbounds function Base.$f(l::Union{Sampled,Categorical}, i::AbstractVector{Int})
if isordered(l)
issorted(i) || throw(ArgumentError("For `ForwardOrdered` or `ReverseOrdered` lookups, indices of `AbstractVector{Int}` must be in ascending order"))
end
rebuild(l; data=Base.$f(parent(l), i))
end
# Selector gets processed with `selectindices`
@propagate_inbounds Base.$f(l::Lookup, i::SelectorOrInterval) = Base.$f(l, selectindices(l, i))
@propagate_inbounds function Base.$f(l::Lookup, i)
Expand Down
Loading