We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
MWE:
julia> struct NamedVector{T,A,B} <: AbstractArray{T,1} data::A names::B end function NamedVector(data, names) @assert size(data) == size(names) NamedVector{eltype(data), typeof(data), typeof(names)}(data, names) end Base.size(n::NamedVector) = size(n.data) Base.getindex(n::NamedVector, i::Int) = n.data[i] Base.to_index(n::NamedVector, name::Symbol) = findfirst(==(name), n.names) Base.checkbounds(::Type{Bool}, n::NamedVector, names::AbstractArray{Symbol}) = all(name in n.names for name in names) julia> n = NamedVector(1:4, [:a, :b, :c, :d]); julia> using InvertedIndices julia> n[Not([:a,:b])] 2-element Array{Int64,1}: 1 2 julia> n[[:a,:b]] 2-element Array{Int64,1}: 1 2
The issue is that arrays don't get their elements converted by to_indices, but we check each element assuming that it did.
to_indices
The text was updated successfully, but these errors were encountered:
No branches or pull requests
MWE:
The issue is that arrays don't get their elements converted by
to_indices
, but we check each element assuming that it did.The text was updated successfully, but these errors were encountered: