tmp/tmpzf3ubz_y/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Concept <a id="iterator.concept.inc">[[iterator.concept.inc]]</a>
|
| 2 |
+
|
| 3 |
+
The `incrementable` concept specifies requirements on types that can be
|
| 4 |
+
incremented with the pre- and post-increment operators. The increment
|
| 5 |
+
operations are required to be equality-preserving, and the type is
|
| 6 |
+
required to be `equality_comparable`.
|
| 7 |
+
|
| 8 |
+
[*Note 1*: This supersedes the annotations on the increment expressions
|
| 9 |
+
in the definition of `weakly_incrementable`. — *end note*]
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
template<class I>
|
| 13 |
+
concept incrementable =
|
| 14 |
+
regular<I> &&
|
| 15 |
+
weakly_incrementable<I> &&
|
| 16 |
+
requires(I i) {
|
| 17 |
+
{ i++ } -> same_as<I>;
|
| 18 |
+
};
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Let `a` and `b` be incrementable objects of type `I`. `I` models
|
| 22 |
+
`incrementable` only if
|
| 23 |
+
|
| 24 |
+
- If `bool(a == b)` then `bool(a++ == b)`.
|
| 25 |
+
- If `bool(a == b)` then `bool(((void)a++, a) == ++b)`.
|
| 26 |
+
|
| 27 |
+
[*Note 2*: The requirement that `a` equals `b` implies `++a` equals
|
| 28 |
+
`++b` (which is not true for weakly incrementable types) allows the use
|
| 29 |
+
of multi-pass one-directional algorithms with types that model
|
| 30 |
+
`incrementable`. — *end note*]
|
| 31 |
+
|