2.1 KiB
[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]
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.
-
If the qualified-idITER_TRAITS(I)::iterator_concept is valid and names a type, then ITER_CONCEPT(I) denotes that type.
-
Otherwise, if the qualified-idITER_TRAITS(I)::iterator_category is valid and names a type, then ITER_CONCEPT(I) denotes that type.
-
Otherwise, if iterator_traits names a specialization generated from the primary template, then ITER_CONCEPT(I) denotes random_access_iterator_tag.
-
Otherwise, ITER_CONCEPT(I) does not denote a type.
[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]