@@ -1719,6 +1719,20 @@ pub fn count<A>(start: A, step: A) -> Counter<A> {
17191719 Counter { state : start, step : step}
17201720}
17211721
1722+ impl < A : Add < A , A > + Clone > Iterator < A > for Counter < A > {
1723+ #[ inline]
1724+ fn next ( & mut self ) -> Option < A > {
1725+ let result = self . state . clone ( ) ;
1726+ self . state = self . state + self . step ;
1727+ Some ( result)
1728+ }
1729+
1730+ #[ inline]
1731+ fn size_hint ( & self ) -> ( uint , Option < uint > ) {
1732+ ( uint:: max_value, None ) // Too bad we can't specify an infinite lower bound
1733+ }
1734+ }
1735+
17221736/// An iterator over the range [start, stop)
17231737#[ deriving( Clone , DeepClone ) ]
17241738pub struct Range < A > {
@@ -1824,20 +1838,6 @@ impl<A: Sub<A, A> + Integer + Ord + Clone> DoubleEndedIterator<A> for RangeInclu
18241838 }
18251839}
18261840
1827- impl < A : Add < A , A > + Clone > Iterator < A > for Counter < A > {
1828- #[ inline]
1829- fn next ( & mut self ) -> Option < A > {
1830- let result = self . state . clone ( ) ;
1831- self . state = self . state + self . step ;
1832- Some ( result)
1833- }
1834-
1835- #[ inline]
1836- fn size_hint ( & self ) -> ( uint , Option < uint > ) {
1837- ( uint:: max_value, None ) // Too bad we can't specify an infinite lower bound
1838- }
1839- }
1840-
18411841/// An iterator that repeats an element endlessly
18421842#[ deriving( Clone , DeepClone ) ]
18431843pub struct Repeat < A > {
0 commit comments