Skip to content

<iterator>: The issue of std::common_iterator::iterator_­category #2067

@hewillk

Description

@hewillk

The standard explains the definition of iterator_category of common_iterator in [iterators.common#common.iter.types-1.2]: "iterator_­category denotes forward_­iterator_­tag if the qualified-id iterator_­traits<I>​::​iterator_­category is valid and denotes a type that models derived_­from<forward_­iterator_­tag>; otherwise it denotes input_­iterator_­tag."
However, the MSVC's implementation is as follows:

STL/stl/inc/iterator

Lines 1034 to 1035 in bd7adb4

using iterator_category =
conditional_t<derived_from<_Iter_cat_t<_Iter>, forward_iterator_tag>, forward_iterator_tag, input_iterator_tag>;

This does not check the validity of iterator_traits<I>​::​iterator_category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions