From Jason Turner

[list.ops]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdjh7x4gl/{from.md → to.md} +17 -15
tmp/tmpdjh7x4gl/{from.md → to.md} RENAMED
@@ -28,19 +28,19 @@ now behave as iterators into `*this`, not into `x`.
28
  ``` cpp
29
  void splice(const_iterator position, list& x, const_iterator i);
30
  void splice(const_iterator position, list&& x, const_iterator i);
31
  ```
32
 
 
 
33
  *Effects:* Inserts an element pointed to by `i` from list `x` before
34
  `position` and removes the element from `x`. The result is unchanged if
35
  `position == i` or `position == ++i`. Pointers and references to `*i`
36
  continue to refer to this same element but as a member of `*this`.
37
  Iterators to `*i` (including `i` itself) continue to refer to the same
38
  element, but now behave as iterators into `*this`, not into `x`.
39
 
40
- *Requires:* `i` is a valid dereferenceable iterator of `x`.
41
-
42
  *Throws:* Nothing.
43
 
44
  *Complexity:* Constant time.
45
 
46
  ``` cpp
@@ -48,19 +48,20 @@ void splice(const_iterator position, list& x, const_iterator first,
48
  const_iterator last);
49
  void splice(const_iterator position, list&& x, const_iterator first,
50
  const_iterator last);
51
  ```
52
 
 
 
 
 
53
  *Effects:* Inserts elements in the range \[`first`, `last`) before
54
- `position` and removes the elements from `x`.
55
-
56
- *Requires:* `[first, last)` is a valid range in `x`. The result is
57
- undefined if `position` is an iterator in the range \[`first`, `last`).
58
- Pointers and references to the moved elements of `x` now refer to those
59
- same elements but as members of `*this`. Iterators referring to the
60
- moved elements will continue to refer to their elements, but they now
61
- behave as iterators into `*this`, not into `x`.
62
 
63
  *Throws:* Nothing.
64
 
65
  *Complexity:* Constant time if `&x == this`; otherwise, linear time.
66
 
@@ -115,20 +116,20 @@ shall be sorted according to this ordering.
115
  *Effects:* If `(&x == this)` does nothing; otherwise, merges the two
116
  sorted ranges `[begin(), end())` and `[x.begin(), x.end())`. The result
117
  is a range in which the elements will be sorted in non-decreasing order
118
  according to the ordering defined by `comp`; that is, for every iterator
119
  `i`, in the range other than the first, the condition
120
- `comp(*i, *(i - 1))` will be false. Pointers and references to the moved
121
- elements of `x` now refer to those same elements but as members of
122
  `*this`. Iterators referring to the moved elements will continue to
123
  refer to their elements, but they now behave as iterators into `*this`,
124
  not into `x`.
125
 
126
  *Remarks:* Stable ([[algorithm.stable]]). If `(&x != this)` the range
127
  `[x.begin(), x.end())` is empty after the merge. No elements are copied
128
  by this operation. The behavior is undefined if
129
- `this->get_allocator() != x.get_allocator()`.
130
 
131
  *Complexity:* At most `size() + x.size() - 1` applications of `comp` if
132
  `(&x != this)`; otherwise, no applications of `comp` are performed. If
133
  an exception is thrown other than by a comparison there are no effects.
134
 
@@ -148,12 +149,13 @@ template <class Compare> void sort(Compare comp);
148
 
149
  *Requires:* `operator<` (for the first version) or `comp` (for the
150
  second version) shall define a strict weak ordering ([[alg.sorting]]).
151
 
152
  *Effects:* Sorts the list according to the `operator<` or a `Compare`
153
- function object. Does not affect the validity of iterators and
 
154
  references.
155
 
156
  *Remarks:* Stable ([[algorithm.stable]]).
157
 
158
- *Complexity:* Approximately N log(N) comparisons, where `N == size()`.
159
 
 
28
  ``` cpp
29
  void splice(const_iterator position, list& x, const_iterator i);
30
  void splice(const_iterator position, list&& x, const_iterator i);
31
  ```
32
 
33
+ *Requires:* `i` is a valid dereferenceable iterator of `x`.
34
+
35
  *Effects:* Inserts an element pointed to by `i` from list `x` before
36
  `position` and removes the element from `x`. The result is unchanged if
37
  `position == i` or `position == ++i`. Pointers and references to `*i`
38
  continue to refer to this same element but as a member of `*this`.
39
  Iterators to `*i` (including `i` itself) continue to refer to the same
40
  element, but now behave as iterators into `*this`, not into `x`.
41
 
 
 
42
  *Throws:* Nothing.
43
 
44
  *Complexity:* Constant time.
45
 
46
  ``` cpp
 
48
  const_iterator last);
49
  void splice(const_iterator position, list&& x, const_iterator first,
50
  const_iterator last);
51
  ```
52
 
53
+ *Requires:* `[first, last)` is a valid range in `x`. The program has
54
+ undefined behavior if `position` is an iterator in the range \[`first`,
55
+ `last`).
56
+
57
  *Effects:* Inserts elements in the range \[`first`, `last`) before
58
+ `position` and removes the elements from `x`. Pointers and references to
59
+ the moved elements of `x` now refer to those same elements but as
60
+ members of `*this`. Iterators referring to the moved elements will
61
+ continue to refer to their elements, but they now behave as iterators
62
+ into `*this`, not into `x`.
 
 
 
63
 
64
  *Throws:* Nothing.
65
 
66
  *Complexity:* Constant time if `&x == this`; otherwise, linear time.
67
 
 
116
  *Effects:* If `(&x == this)` does nothing; otherwise, merges the two
117
  sorted ranges `[begin(), end())` and `[x.begin(), x.end())`. The result
118
  is a range in which the elements will be sorted in non-decreasing order
119
  according to the ordering defined by `comp`; that is, for every iterator
120
  `i`, in the range other than the first, the condition
121
+ `comp(*i, *(i - 1))` will be `false`. Pointers and references to the
122
+ moved elements of `x` now refer to those same elements but as members of
123
  `*this`. Iterators referring to the moved elements will continue to
124
  refer to their elements, but they now behave as iterators into `*this`,
125
  not into `x`.
126
 
127
  *Remarks:* Stable ([[algorithm.stable]]). If `(&x != this)` the range
128
  `[x.begin(), x.end())` is empty after the merge. No elements are copied
129
  by this operation. The behavior is undefined if
130
+ `get_allocator() != x.get_allocator()`.
131
 
132
  *Complexity:* At most `size() + x.size() - 1` applications of `comp` if
133
  `(&x != this)`; otherwise, no applications of `comp` are performed. If
134
  an exception is thrown other than by a comparison there are no effects.
135
 
 
149
 
150
  *Requires:* `operator<` (for the first version) or `comp` (for the
151
  second version) shall define a strict weak ordering ([[alg.sorting]]).
152
 
153
  *Effects:* Sorts the list according to the `operator<` or a `Compare`
154
+ function object. If an exception is thrown, the order of the elements in
155
+ `*this` is unspecified. Does not affect the validity of iterators and
156
  references.
157
 
158
  *Remarks:* Stable ([[algorithm.stable]]).
159
 
160
+ *Complexity:* Approximately N log N comparisons, where `N == size()`.
161