#ifndef PYTHONIC_INCLUDE_ITERTOOLS_COUNT_HPP #define PYTHONIC_INCLUDE_ITERTOOLS_COUNT_HPP #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/combined.hpp" #include PYTHONIC_NS_BEGIN namespace itertools { namespace details { template struct count_iterator : std::iterator { T value; T step; count_iterator() = default; count_iterator(T value, T step); T operator*() const; count_iterator &operator++(); count_iterator &operator+=(long n); bool operator!=(count_iterator const &other) const; bool operator==(count_iterator const &other) const; bool operator<(count_iterator const &other) const; long operator-(count_iterator const &other) const; }; template struct count : count_iterator { using value_type = T; using iterator = count_iterator; count() = default; count(T value, T step); iterator &begin(); iterator const &begin() const; iterator end() const; }; } template details::count::type> count(T0 start, T1 step = 1); details::count count(); DEFINE_FUNCTOR(pythonic::itertools, count); } PYTHONIC_NS_END /* type inference stuff {*/ #include "pythonic/include/types/combined.hpp" template struct __combined> { using type = typename __combined::value_type>>::type; }; /* } */ #endif