diff --git a/src/IndirectArrays.jl b/src/IndirectArrays.jl index ec14cda..7961497 100644 --- a/src/IndirectArrays.jl +++ b/src/IndirectArrays.jl @@ -40,6 +40,18 @@ Base.IndexStyle(::Type{IndirectArray{T,N,A,V}}) where {T,N,A,V} = IndexStyle(A) Base.copy(A::IndirectArray) = IndirectArray(copy(A.index), copy(A.values)) +if VERSION < v"0.6.3" + # This method is only necessary because of a bug in Julia 0.6.2 and can be removed + # when we no longer support that version + @inline function Base.getindex(A::IndirectArray{<:Any,1}, i::Int) + @boundscheck checkbounds(A.index, i) + @inbounds idx = A.index[i] + @boundscheck checkbounds(A.values, idx) + @inbounds ret = A.values[idx] + ret + end +end + @inline function Base.getindex(A::IndirectArray, i::Int) @boundscheck checkbounds(A.index, i) @inbounds idx = A.index[i]