#ifndef PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP #define PYTHONIC_INCLUDE_ITERTOOLS_COMBINATIONS_HPP #include "pythonic/include/types/dynamic_tuple.hpp" #include "pythonic/include/utils/functor.hpp" #include #include PYTHONIC_NS_BEGIN namespace itertools { namespace details { template struct combination_iterator : std::iterator, ptrdiff_t, types::dynamic_tuple *, types::dynamic_tuple /*no ref*/ > { std::vector pool; std::vector indices; long r; bool stopped; std::vector result; combination_iterator() = default; combination_iterator(bool); template combination_iterator(Iter &&pool, long r); types::dynamic_tuple operator*() const; combination_iterator &operator++(); bool operator!=(combination_iterator const &other) const; bool operator==(combination_iterator const &other) const; bool operator<(combination_iterator const &other) const; }; template struct combination : combination_iterator { using iterator = combination_iterator; using value_type = typename iterator::value_type; long num_elts; combination() = default; template combination(Iter &&iter, long elts); iterator const &begin() const; iterator begin(); iterator end() const; }; } template details::combination< typename std::remove_cv::type>::type> combinations(T0 &&iter, long num_elts); DEFINE_FUNCTOR(pythonic::itertools, combinations); } PYTHONIC_NS_END /* type inference stuff {*/ #include "pythonic/include/types/combined.hpp" template struct __combined> { using type = typename __combined::value_type>>::type; }; /* } */ #endif