From Jason Turner

[forwardlist.ops]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzn5l5t15/{from.md → to.md} +0 -161
tmp/tmpzn5l5t15/{from.md → to.md} RENAMED
@@ -1,161 +0,0 @@
1
- #### Operations <a id="forwardlist.ops">[[forwardlist.ops]]</a>
2
-
3
- In this subclause, arguments for a template parameter named `Predicate`
4
- or `BinaryPredicate` shall meet the corresponding requirements in
5
- [[algorithms.requirements]]. For `merge` and `sort`, the definitions and
6
- requirements in [[alg.sorting]] apply.
7
-
8
- ``` cpp
9
- void splice_after(const_iterator position, forward_list& x);
10
- void splice_after(const_iterator position, forward_list&& x);
11
- ```
12
-
13
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
14
- iterator in the range \[`begin()`, `end()`).
15
- `get_allocator() == x.get_allocator()` is `true`. `addressof(x) != this`
16
- is `true`.
17
-
18
- *Effects:* Inserts the contents of `x` after `position`, and `x` becomes
19
- empty. Pointers and references to the moved elements of `x` now refer to
20
- those same elements but as members of `*this`. Iterators referring to
21
- the moved elements will continue to refer to their elements, but they
22
- now behave as iterators into `*this`, not into `x`.
23
-
24
- *Throws:* Nothing.
25
-
26
- *Complexity:* 𝑂(`distance(x.begin(), x.end())`)
27
-
28
- ``` cpp
29
- void splice_after(const_iterator position, forward_list& x, const_iterator i);
30
- void splice_after(const_iterator position, forward_list&& x, const_iterator i);
31
- ```
32
-
33
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
34
- iterator in the range \[`begin()`, `end()`). The iterator following `i`
35
- is a dereferenceable iterator in `x`.
36
- `get_allocator() == x.get_allocator()` is `true`.
37
-
38
- *Effects:* Inserts the element following `i` into `*this`, following
39
- `position`, and removes it from `x`. The result is unchanged if
40
- `position == i` or `position == ++i`. Pointers and references to `*++i`
41
- continue to refer to the same element but as a member of `*this`.
42
- Iterators to `*++i` continue to refer to the same element, but now
43
- behave as iterators into `*this`, not into `x`.
44
-
45
- *Throws:* Nothing.
46
-
47
- *Complexity:* 𝑂(1)
48
-
49
- ``` cpp
50
- void splice_after(const_iterator position, forward_list& x,
51
- const_iterator first, const_iterator last);
52
- void splice_after(const_iterator position, forward_list&& x,
53
- const_iterator first, const_iterator last);
54
- ```
55
-
56
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
57
- iterator in the range \[`begin()`, `end()`). (`first`, `last`) is a
58
- valid range in `x`, and all iterators in the range (`first`, `last`) are
59
- dereferenceable. `position` is not an iterator in the range (`first`,
60
- `last`). `get_allocator() == x.get_allocator()` is `true`.
61
-
62
- *Effects:* Inserts elements in the range (`first`, `last`) after
63
- `position` and removes the elements from `x`. Pointers and references to
64
- the moved elements of `x` now refer to those same elements but as
65
- members of `*this`. Iterators referring to the moved elements will
66
- continue to refer to their elements, but they now behave as iterators
67
- into `*this`, not into `x`.
68
-
69
- *Complexity:* 𝑂(`distance(first, last)`)
70
-
71
- ``` cpp
72
- size_type remove(const T& value);
73
- template<class Predicate> size_type remove_if(Predicate pred);
74
- ```
75
-
76
- *Effects:* Erases all the elements in the list referred to by a list
77
- iterator `i` for which the following conditions hold: `*i == value` (for
78
- `remove()`), `pred(*i)` is `true` (for `remove_if()`). Invalidates only
79
- the iterators and references to the erased elements.
80
-
81
- *Returns:* The number of elements erased.
82
-
83
- *Throws:* Nothing unless an exception is thrown by the equality
84
- comparison or the predicate.
85
-
86
- *Remarks:* Stable [[algorithm.stable]].
87
-
88
- *Complexity:* Exactly `distance(begin(), end())` applications of the
89
- corresponding predicate.
90
-
91
- ``` cpp
92
- size_type unique();
93
- template<class BinaryPredicate> size_type unique(BinaryPredicate pred);
94
- ```
95
-
96
- *Effects:* Erases all but the first element from every consecutive group
97
- of equal elements referred to by the iterator `i` in the range
98
- \[`first + 1`, `last`) for which `*i == *(i-1)` (for the version with no
99
- arguments) or `pred(*i, *(i - 1))` (for the version with a predicate
100
- argument) holds. Invalidates only the iterators and references to the
101
- erased elements.
102
-
103
- *Returns:* The number of elements erased.
104
-
105
- *Throws:* Nothing unless an exception is thrown by the equality
106
- comparison or the predicate.
107
-
108
- *Complexity:* If the range \[`first`, `last`) is not empty, exactly
109
- `(last - first) - 1` applications of the corresponding predicate,
110
- otherwise no applications of the predicate.
111
-
112
- ``` cpp
113
- void merge(forward_list& x);
114
- void merge(forward_list&& x);
115
- template<class Compare> void merge(forward_list& x, Compare comp);
116
- template<class Compare> void merge(forward_list&& x, Compare comp);
117
- ```
118
-
119
- *Preconditions:* `*this` and `x` are both sorted with respect to the
120
- comparator `operator<` (for the first two overloads) or `comp` (for the
121
- last two overloads), and `get_allocator() == x.get_allocator()` is
122
- `true`.
123
-
124
- *Effects:* Merges the two sorted ranges `[begin(), end())` and
125
- `[x.begin(), x.end())`. `x` is empty after the merge. If an exception is
126
- thrown other than by a comparison there are no effects. Pointers and
127
- references to the moved elements of `x` now refer to those same elements
128
- but as members of `*this`. Iterators referring to the moved elements
129
- will continue to refer to their elements, but they now behave as
130
- iterators into `*this`, not into `x`.
131
-
132
- *Remarks:* Stable [[algorithm.stable]].
133
-
134
- *Complexity:* At most
135
- `distance(begin(), end()) + distance(x.begin(), x.end()) - 1`
136
- comparisons.
137
-
138
- ``` cpp
139
- void sort();
140
- template<class Compare> void sort(Compare comp);
141
- ```
142
-
143
- *Effects:* Sorts the list according to the `operator<` or the `comp`
144
- function object. If an exception is thrown, the order of the elements in
145
- `*this` is unspecified. Does not affect the validity of iterators and
146
- references.
147
-
148
- *Remarks:* Stable [[algorithm.stable]].
149
-
150
- *Complexity:* Approximately N log N comparisons, where N is
151
- `distance(begin(), end())`.
152
-
153
- ``` cpp
154
- void reverse() noexcept;
155
- ```
156
-
157
- *Effects:* Reverses the order of the elements in the list. Does not
158
- affect the validity of iterators and references.
159
-
160
- *Complexity:* Linear time.
161
-