From Jason Turner

[iterator.concepts.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp86tjpr7x/{from.md → to.md} +41 -0
tmp/tmp86tjpr7x/{from.md → to.md} RENAMED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### General <a id="iterator.concepts.general">[[iterator.concepts.general]]</a>
2
+
3
+ For a type `I`, let `ITER_TRAITS(I)` denote the type `I` if
4
+ `iterator_traits<I>` names a specialization generated from the primary
5
+ template. Otherwise, `ITER_TRAITS(I)` denotes `iterator_traits<I>`.
6
+
7
+ - If the *qualified-id* `ITER_TRAITS(I)::iterator_concept` is valid and
8
+ names a type, then `ITER_CONCEPT(I)` denotes that type.
9
+ - Otherwise, if the *qualified-id* `ITER_TRAITS(I){}::iterator_category`
10
+ is valid and names a type, then `ITER_CONCEPT(I)` denotes that type.
11
+ - Otherwise, if `iterator_traits<I>` names a specialization generated
12
+ from the primary template, then `ITER_CONCEPT(I)` denotes
13
+ `random_access_iterator_tag`.
14
+ - Otherwise, `ITER_CONCEPT(I)` does not denote a type.
15
+
16
+ [*Note 1*: `ITER_TRAITS` enables independent syntactic determination of
17
+ an iterator’s category and concept. — *end note*]
18
+
19
+ [*Example 1*:
20
+
21
+ ``` cpp
22
+ struct I {
23
+ using value_type = int;
24
+ using difference_type = int;
25
+
26
+ int operator*() const;
27
+ I& operator++();
28
+ I operator++(int);
29
+ I& operator--();
30
+ I operator--(int);
31
+
32
+ bool operator==(I) const;
33
+ bool operator!=(I) const;
34
+ };
35
+ ```
36
+
37
+ `iterator_traits<I>::iterator_category` denotes `input_iterator_tag`,
38
+ and `ITER_CONCEPT(I)` denotes `random_access_iterator_tag`.
39
+
40
+ — *end example*]
41
+