From Jason Turner

[forwardlist.ops]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2wrzcs_8/{from.md → to.md} +32 -25
tmp/tmp2wrzcs_8/{from.md → to.md} RENAMED
@@ -4,11 +4,12 @@
4
  void splice_after(const_iterator position, forward_list& x);
5
  void splice_after(const_iterator position, forward_list&& x);
6
  ```
7
 
8
  *Requires:* `position` is `before_begin()` or is a dereferenceable
9
- iterator in the range \[`begin()`, `end()`). `&x != this`.
 
10
 
11
  *Effects:* Inserts the contents of `x` after `position`, and `x` becomes
12
  empty. Pointers and references to the moved elements of `x` now refer to
13
  those same elements but as members of `*this`. Iterators referring to
14
  the moved elements will continue to refer to their elements, but they
@@ -24,17 +25,18 @@ void splice_after(const_iterator position, forward_list&& x, const_iterator i);
24
  ```
25
 
26
  *Requires:* `position` is `before_begin()` or is a dereferenceable
27
  iterator in the range \[`begin()`, `end()`). The iterator following `i`
28
  is a dereferenceable iterator in `x`.
 
29
 
30
  *Effects:* Inserts the element following `i` into `*this`, following
31
  `position`, and removes it from `x`. The result is unchanged if
32
- `position == i` or `position == ++i`. Pointers and references to `*i`
33
  continue to refer to the same element but as a member of `*this`.
34
- Iterators to `*i` (including `i` itself) continue to refer to the same
35
- element, but now behave as iterators into `*this`, not into `x`.
36
 
37
  *Throws:* Nothing.
38
 
39
  *Complexity:* 𝑂(1)
40
 
@@ -47,11 +49,11 @@ void splice_after(const_iterator position, forward_list&& x,
47
 
48
  *Requires:* `position` is `before_begin()` or is a dereferenceable
49
  iterator in the range \[`begin()`, `end()`). (`first`, `last`) is a
50
  valid range in `x`, and all iterators in the range (`first`, `last`) are
51
  dereferenceable. `position` is not an iterator in the range (`first`,
52
- `last`).
53
 
54
  *Effects:* Inserts elements in the range (`first`, `last`) after
55
  `position` and removes the elements from `x`. Pointers and references to
56
  the moved elements of `x` now refer to those same elements but as
57
  members of `*this`. Iterators referring to the moved elements will
@@ -65,18 +67,18 @@ void remove(const T& value);
65
  template <class Predicate> void remove_if(Predicate pred);
66
  ```
67
 
68
  *Effects:* Erases all the elements in the list referred by a list
69
  iterator `i` for which the following conditions hold: `*i == value` (for
70
- `remove()`), `pred(*i)` is true (for `remove_if()`). This operation
71
- shall be stable: the relative order of the elements that are not removed
72
- is the same as their relative order in the original list. Invalidates
73
- only the iterators and references to the erased elements.
74
 
75
  *Throws:* Nothing unless an exception is thrown by the equality
76
  comparison or the predicate.
77
 
 
 
78
  *Complexity:* Exactly `distance(begin(), end())` applications of the
79
  corresponding predicate.
80
 
81
  ``` cpp
82
  void unique();
@@ -98,28 +100,32 @@ comparison or the predicate.
98
  otherwise no applications of the predicate.
99
 
100
  ``` cpp
101
  void merge(forward_list& x);
102
  void merge(forward_list&& x);
103
- template <class Compare> void merge(forward_list& x, Compare comp)
104
- template <class Compare> void merge(forward_list&& x, Compare comp)
105
  ```
106
 
107
  *Requires:* `comp` defines a strict weak ordering ([[alg.sorting]]),
108
  and `*this` and `x` are both sorted according to this ordering.
 
109
 
110
- *Effects:* Merges `x` into `*this`. This operation shall be stable: for
111
- equivalent elements in the two lists, the elements from `*this` shall
112
- always precede the elements from `x`. `x` is empty after the merge. If
113
- an exception is thrown other than by a comparison there are no effects.
114
- Pointers and references to the moved elements of `x` now refer to those
115
- same elements but as members of `*this`. Iterators referring to the
116
- moved elements will continue to refer to their elements, but they now
117
- behave as iterators into `*this`, not into `x`.
118
 
119
- *Complexity:* At most distance(begin(), end()) + distance(x.begin(),
120
- x.end()) - 1 comparisons.
 
 
 
 
121
 
122
  ``` cpp
123
  void sort();
124
  template <class Compare> void sort(Compare comp);
125
  ```
@@ -127,14 +133,15 @@ template <class Compare> void sort(Compare comp);
127
  *Requires:* `operator<` (for the version with no arguments) or `comp`
128
  (for the version with a comparison argument) defines a strict weak
129
  ordering ([[alg.sorting]]).
130
 
131
  *Effects:* Sorts the list according to the `operator<` or the `comp`
132
- function object. This operation shall be stable: the relative order of
133
- the equivalent elements is preserved. If an exception is thrown the
134
- order of the elements in `*this` is unspecified. Does not affect the
135
- validity of iterators and references.
 
136
 
137
  *Complexity:* Approximately N log N comparisons, where N is
138
  `distance(begin(), end())`.
139
 
140
  ``` cpp
 
4
  void splice_after(const_iterator position, forward_list& x);
5
  void splice_after(const_iterator position, forward_list&& x);
6
  ```
7
 
8
  *Requires:* `position` is `before_begin()` or is a dereferenceable
9
+ iterator in the range \[`begin()`, `end()`).
10
+ `get_allocator() == x.get_allocator()`. `&x != this`.
11
 
12
  *Effects:* Inserts the contents of `x` after `position`, and `x` becomes
13
  empty. Pointers and references to the moved elements of `x` now refer to
14
  those same elements but as members of `*this`. Iterators referring to
15
  the moved elements will continue to refer to their elements, but they
 
25
  ```
26
 
27
  *Requires:* `position` is `before_begin()` or is a dereferenceable
28
  iterator in the range \[`begin()`, `end()`). The iterator following `i`
29
  is a dereferenceable iterator in `x`.
30
+ `get_allocator() == x.get_allocator()`.
31
 
32
  *Effects:* Inserts the element following `i` into `*this`, following
33
  `position`, and removes it from `x`. The result is unchanged if
34
+ `position == i` or `position == ++i`. Pointers and references to `*++i`
35
  continue to refer to the same element but as a member of `*this`.
36
+ Iterators to `*++i` continue to refer to the same element, but now
37
+ behave as iterators into `*this`, not into `x`.
38
 
39
  *Throws:* Nothing.
40
 
41
  *Complexity:* 𝑂(1)
42
 
 
49
 
50
  *Requires:* `position` is `before_begin()` or is a dereferenceable
51
  iterator in the range \[`begin()`, `end()`). (`first`, `last`) is a
52
  valid range in `x`, and all iterators in the range (`first`, `last`) are
53
  dereferenceable. `position` is not an iterator in the range (`first`,
54
+ `last`). `get_allocator() == x.get_allocator()`.
55
 
56
  *Effects:* Inserts elements in the range (`first`, `last`) after
57
  `position` and removes the elements from `x`. Pointers and references to
58
  the moved elements of `x` now refer to those same elements but as
59
  members of `*this`. Iterators referring to the moved elements will
 
67
  template <class Predicate> void remove_if(Predicate pred);
68
  ```
69
 
70
  *Effects:* Erases all the elements in the list referred by a list
71
  iterator `i` for which the following conditions hold: `*i == value` (for
72
+ `remove()`), `pred(*i)` is true (for `remove_if()`). Invalidates only
73
+ the iterators and references to the erased elements.
 
 
74
 
75
  *Throws:* Nothing unless an exception is thrown by the equality
76
  comparison or the predicate.
77
 
78
+ *Remarks:* Stable ([[algorithm.stable]]).
79
+
80
  *Complexity:* Exactly `distance(begin(), end())` applications of the
81
  corresponding predicate.
82
 
83
  ``` cpp
84
  void unique();
 
100
  otherwise no applications of the predicate.
101
 
102
  ``` cpp
103
  void merge(forward_list& x);
104
  void merge(forward_list&& x);
105
+ template <class Compare> void merge(forward_list& x, Compare comp);
106
+ template <class Compare> void merge(forward_list&& x, Compare comp);
107
  ```
108
 
109
  *Requires:* `comp` defines a strict weak ordering ([[alg.sorting]]),
110
  and `*this` and `x` are both sorted according to this ordering.
111
+ `get_allocator() == x.get_allocator()`.
112
 
113
+ *Effects:* Merges the two sorted ranges `[begin(), end())` and
114
+ `[x.begin(), x.end())`. `x` is empty after the merge. If an exception is
115
+ thrown other than by a comparison there are no effects. Pointers and
116
+ references to the moved elements of `x` now refer to those same elements
117
+ but as members of `*this`. Iterators referring to the moved elements
118
+ will continue to refer to their elements, but they now behave as
119
+ iterators into `*this`, not into `x`.
 
120
 
121
+ *Remarks:* Stable ([[algorithm.stable]]). The behavior is undefined if
122
+ `this->get_allocator() != x.get_allocator()`.
123
+
124
+ *Complexity:* At most
125
+ `distance(begin(), end()) + distance(x.begin(), x.end()) - 1`
126
+ comparisons.
127
 
128
  ``` cpp
129
  void sort();
130
  template <class Compare> void sort(Compare comp);
131
  ```
 
133
  *Requires:* `operator<` (for the version with no arguments) or `comp`
134
  (for the version with a comparison argument) defines a strict weak
135
  ordering ([[alg.sorting]]).
136
 
137
  *Effects:* Sorts the list according to the `operator<` or the `comp`
138
+ function object. If an exception is thrown the order of the elements in
139
+ `*this` is unspecified. Does not affect the validity of iterators and
140
+ references.
141
+
142
+ *Remarks:* Stable ([[algorithm.stable]]).
143
 
144
  *Complexity:* Approximately N log N comparisons, where N is
145
  `distance(begin(), end())`.
146
 
147
  ``` cpp