mapbox/eternal

Iterator is not compatible with std algorithms

jan-moeller opened this issue · 1 comments

This can be fixed by adding

namespace std
{
template<typename Element>
struct iterator_traits<::mapbox::eternal::iterator<Element>>
{
    using difference_type = std::size_t;
    using value_type = Element;
    using pointer = value_type*;
    using reference = value_type&;
    using iterator_category = std::bidirectional_iterator_tag;
};
} // namespace std

or by adding the typedefs to the type directly.

Note that difference_type should probably be std::ptrdiff_t and not std::size_t, and thus the return type of operator-() should be adapted.

Thanks! I created a preliminary PR in #3