Skip to content

Commit

Permalink
fixup! Add Iterator#cons returning a pair
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Oct 17, 2019
1 parent 5294b0c commit 5510382
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/iterator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ module Iterator(T)
# Chunks of more than two items can be iterated using
# `#cons(count : Int, reuse = false)`. This method is just an optimized
# implementation for the special case of `size == 2` to avoid heap allocations.
def cons
def cons : Iterator({T, T})
ConsTuple(typeof(self), T).new(self)
end

private struct ConsTuple(I, T)
include Iterator(Tuple(T, T))
include Iterator({T, T})
include IteratorWrapper

@last_elem : T | Iterator::Stop = Iterator::Stop::INSTANCE
Expand Down

0 comments on commit 5510382

Please sign in to comment.