From Jason Turner

[depr.iterator]

Diff to HTML by rtfpessoa

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