Files
2025-10-25 03:02:53 +03:00

2.1 KiB
Raw Permalink Blame History

[iterator.concepts.general]

24 Iterators library [iterators]

24.3 Iterator requirements [iterator.requirements]

24.3.4 Iterator concepts [iterator.concepts]

24.3.4.1 General [iterator.concepts.general]

1

#

For a type I, let ITER_TRAITS(I) denote the type I if iterator_traits names a specialization generated from the primary template.

Otherwise, ITER_TRAITS(I) denotesiterator_traits.

  • (1.1)

    If the qualified-idITER_TRAITS(I)::iterator_concept is valid and names a type, then ITER_CONCEPT(I) denotes that type.

  • (1.2)

    Otherwise, if the qualified-idITER_TRAITS(I)::iterator_category is valid and names a type, then ITER_CONCEPT(I) denotes that type.

  • (1.3)

    Otherwise, if iterator_traits names a specialization generated from the primary template, then ITER_CONCEPT(I) denotes random_access_iterator_tag.

  • (1.4)

    Otherwise, ITER_CONCEPT(I) does not denote a type.

2

#

[Note 1:

ITER_TRAITS enables independent syntactic determination of an iterator's category and concept.

— end note]

[Example 1:

struct I {using value_type = int; using difference_type = int; int operator*() const; I& operator++(); I operator++(int); I& operator--(); I operator--(int); bool operator==(I) const;};iterator_traits::iterator_category denotes input_iterator_tag, and ITER_CONCEPT(I) denotes random_access_iterator_tag.

— end example]