#ifndef PYTHONIC_INCLUDE_UTILS_ITERATOR_HPP #define PYTHONIC_INCLUDE_UTILS_ITERATOR_HPP PYTHONIC_NS_BEGIN namespace utils { template struct comparable_iterator : T { comparable_iterator(); comparable_iterator(T const &t); bool operator<(comparable_iterator other); }; // Utility class to remind sequence we are iterating on to avoid dangling // reference template struct iterator_reminder; template struct iterator_reminder { std::tuple values; // FIXME : It works only because template arguments are ! references // so it trigger a copy. iterator_reminder() = default; iterator_reminder(T const &v, Others const &... o); }; template struct iterator_reminder { T values; iterator_reminder() = default; iterator_reminder(T const &v); }; template struct iterator_reminder { std::tuple values; iterator_reminder() = default; iterator_reminder(T const &v); }; /* Get the "minimum" of all iterators : - only random => random - at least one forward => forward */ template struct iterator_min; template struct iterator_min { using type = typename std::iterator_traits::iterator_category; }; template struct iterator_min { using type = typename std::conditional< std::is_same::iterator_category, std::forward_iterator_tag>::value, std::forward_iterator_tag, typename iterator_min::type>::type; }; } PYTHONIC_NS_END #endif