From Jason Turner

[depr.iterator.primitives]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2vhfml3g/{from.md → to.md} +42 -0
tmp/tmp2vhfml3g/{from.md → to.md} RENAMED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Deprecated iterator primitives <a id="depr.iterator.primitives">[[depr.iterator.primitives]]</a>
2
+
3
+ ### Basic iterator <a id="depr.iterator.basic">[[depr.iterator.basic]]</a>
4
+
5
+ The header `<iterator>` has the following addition:
6
+
7
+ ``` cpp
8
+ namespace std {
9
+ template<class Category, class T, class Distance = ptrdiff_t,
10
+ class Pointer = T*, class Reference = T&>
11
+ struct iterator {
12
+ using iterator_category = Category;
13
+ using value_type = T;
14
+ using difference_type = Distance;
15
+ using pointer = Pointer;
16
+ using reference = Reference;
17
+ };
18
+ }
19
+ ```
20
+
21
+ The `iterator` template may be used as a base class to ease the
22
+ definition of required types for new iterators.
23
+
24
+ [*Note 1*: If the new iterator type is a class template, then these
25
+ aliases will not be visible from within the iterator class’s template
26
+ definition, but only to callers of that class. — *end note*]
27
+
28
+ [*Example 1*:
29
+
30
+ If a C++program wants to define a bidirectional iterator for some data
31
+ structure containing `double` and such that it works on a large memory
32
+ model of the implementation, it can do so with:
33
+
34
+ ``` cpp
35
+ class MyIterator :
36
+ public iterator<bidirectional_iterator_tag, double, long, T*, T&> {
37
+ // code implementing ++, etc.
38
+ };
39
+ ```
40
+
41
+ — *end example*]
42
+