Skip to content

Commit

Permalink
Fix reparamterization of CartesianRange on 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jul 13, 2017
1 parent ea6ee0a commit 61b7c34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/autorange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ immutable CornerIterator{I<:CartesianIndex}
start::I
stop::I
end
CornerIterator{I<:CartesianIndex}(R::CartesianRange{I}) = CornerIterator{I}(first(R), last(R))
CornerIterator(R::CartesianRange) = CornerIterator(first(R), last(R))

eltype{I}(::Type{CornerIterator{I}}) = I
iteratorsize{I}(::Type{CornerIterator{I}}) = Base.HasShape()
Expand Down
10 changes: 8 additions & 2 deletions src/resizing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ end
@inline map3(f, a, b, c) = (f(a[1], b[1], c[1]), map3(f, tail(a), tail(b), tail(c))...)
@inline map3(f, ::Tuple{}, ::Tuple{}, ::Tuple{}) = ()

function clampR{N}(I::NTuple{N}, R::CartesianRange{CartesianIndex{N}})
map3(clamp, I, first(R).I, last(R).I)
if VERSION < v"0.7.0-DEV.880"
function clampR{N}(I::NTuple{N}, R::CartesianRange{CartesianIndex{N}})
map3(clamp, I, first(R).I, last(R).I)
end
else
function clampR{N}(I::NTuple{N}, R::CartesianRange{N})
map3(clamp, I, first(R).I, last(R).I)
end
end

0 comments on commit 61b7c34

Please sign in to comment.