From Jason Turner

[iterator.concept.bidir]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdlmwqmw6/{from.md → to.md} +32 -0
tmp/tmpdlmwqmw6/{from.md → to.md} RENAMED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Concept <a id="iterator.concept.bidir">[[iterator.concept.bidir]]</a>
2
+
3
+ The `bidirectional_iterator` concept adds the ability to move an
4
+ iterator backward as well as forward.
5
+
6
+ ``` cpp
7
+ template<class I>
8
+ concept bidirectional_iterator =
9
+ forward_iterator<I> &&
10
+ derived_from<ITER_CONCEPT(I), bidirectional_iterator_tag> &&
11
+ requires(I i) {
12
+ { --i } -> same_as<I&>;
13
+ { i-- } -> same_as<I>;
14
+ };
15
+ ```
16
+
17
+ A bidirectional iterator `r` is decrementable if and only if there
18
+ exists some `q` such that `++q == r`. Decrementable iterators `r` shall
19
+ be in the domain of the expressions `--r` and `r--`.
20
+
21
+ Let `a` and `b` be equal objects of type `I`. `I` models
22
+ `bidirectional_iterator` only if:
23
+
24
+ - If `a` and `b` are decrementable, then all of the following are
25
+ `true`:
26
+ - `addressof(--a) == addressof(a)`
27
+ - `bool(a-- == b)`
28
+ - after evaluating both `a--` and `--b`, `bool(a == b)` is still
29
+ `true`
30
+ - `bool(++(--a) == b)`
31
+ - If `a` and `b` are incrementable, then `bool(--(++a) == b)`.
32
+