Skip to content

Iterator is not compatible with std algorithms #2

@jan-moeller

Description

@jan-moeller

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions