Skip to content

Commit

Permalink
Temporarily add method to work around subtyping bug in Julia 0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Mar 15, 2018
1 parent b915ef0 commit 6771170
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/IndirectArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 6771170

Please sign in to comment.