#ifndef PYTHONIC_ITERTOOLS_REPEAT_HPP #define PYTHONIC_ITERTOOLS_REPEAT_HPP #include "pythonic/include/itertools/repeat.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/types/list.hpp" PYTHONIC_NS_BEGIN namespace itertools { template repeat_iterator::repeat_iterator(T value, long count) : value_(value), count_(count) { } template repeat_iterator &repeat_iterator::operator++() { ++count_; return *this; } template T repeat_iterator::operator*() { return value_; } template bool repeat_iterator:: operator!=(repeat_iterator const &other) const { return Endless || count_ != other.count_; } template bool repeat_iterator:: operator==(repeat_iterator const &other) const { return !Endless && count_ == other.count_; } template bool repeat_iterator:: operator<(repeat_iterator const &other) const { return !Endless && count_ < other.count_; } template _repeat::_repeat(T value, long count) : repeat_iterator(value, count) { } template typename _repeat::iterator _repeat::begin() const { return {_repeat::iterator::value_, 0}; } template typename _repeat::iterator _repeat::end() const { return *this; } template _repeat repeat(T value, long count) { return {value, count}; } template _repeat repeat(T value) { return {value, -1}; } } PYTHONIC_NS_END #endif