diff --git a/src/readonly.jl b/src/readonly.jl index 00eacc3c..8d219f0c 100644 --- a/src/readonly.jl +++ b/src/readonly.jl @@ -13,13 +13,16 @@ ReadOnly(x::ReadOnly) = x Base.getproperty(x::ReadOnly, s::Symbol) = Base.getproperty(parent(x), s) @inline Base.parent(x::ReadOnly) = getfield(x, :parent) -for i in [:length, :first, :last, :eachindex, :firstindex, :lastindex, :axes, :size] +for i in [:length, :first, :last, :axes, :size] @eval Base.@propagate_inbounds @inline Base.$i(x::ReadOnly) = Base.$i(parent(x)) end for i in [:iterate, :getindex, :strides] @eval(Base.@propagate_inbounds @inline Base.$i(x::ReadOnly, y...) = Base.$i(parent(x), y...)) end +Base.eachindex(i::IndexLinear, x::ReadOnly) = eachindex(i, parent(x)) +Base.eachindex(i::IndexCartesian, x::ReadOnly) = eachindex(i, parent(x)) + Base.unsafe_convert(x::Type{Ptr{T}}, A::ReadOnly) where T = Base.unsafe_convert(x, parent(A)) Base.elsize(::Type{ReadOnly{T,N,V}}) where {T,N,V} = Base.elsize(V) Base.@propagate_inbounds @inline Base.setindex!(x::ReadOnly, v, ind...) = if v == getindex(parent(x), ind...)