61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
[iterator.concepts.general]
|
||
|
||
# 24 Iterators library [[iterators]](./#iterators)
|
||
|
||
## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#iterator.concepts.general)
|
||
|
||
### 24.3.4 Iterator concepts [[iterator.concepts]](iterator.concepts#general)
|
||
|
||
#### 24.3.4.1 General [iterator.concepts.general]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L1252)
|
||
|
||
For a type I, let *ITER_TRAITS*(I) denote
|
||
the type I if iterator_traits<I> names
|
||
a specialization generated from the primary template[.](#1.sentence-1)
|
||
|
||
Otherwise, *ITER_TRAITS*(I) denotesiterator_traits<I>[.](#1.sentence-2)
|
||
|
||
- [(1.1)](#1.1)
|
||
|
||
If the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]")*ITER_TRAITS*(I)::iterator_concept is valid
|
||
and names a type, then *ITER_CONCEPT*(I) denotes that
|
||
type[.](#1.1.sentence-1)
|
||
|
||
- [(1.2)](#1.2)
|
||
|
||
Otherwise, if the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]")*ITER_TRAITS*(I)::iterator_category is valid and names a type, then *ITER_CONCEPT*(I) denotes that type[.](#1.2.sentence-1)
|
||
|
||
- [(1.3)](#1.3)
|
||
|
||
Otherwise, if iterator_traits<I> names a specialization generated
|
||
from the primary template, then *ITER_CONCEPT*(I) denotes random_access_iterator_tag[.](#1.3.sentence-1)
|
||
|
||
- [(1.4)](#1.4)
|
||
|
||
Otherwise, *ITER_CONCEPT*(I) does not denote a type[.](#1.4.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L1273)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
*ITER_TRAITS* enables independent syntactic determination
|
||
of an iterator's category and concept[.](#2.sentence-1)
|
||
|
||
â *end note*]
|
||
|
||
[*Example [1](#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<I>::iterator_category denotes input_iterator_tag,
|
||
and *ITER_CONCEPT*(I) denotes random_access_iterator_tag[.](#2.sentence-2)
|
||
|
||
â *end example*]
|