From Jason Turner

[forwardlist.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpu032rvlo/{from.md → to.md} +0 -149
tmp/tmpu032rvlo/{from.md → to.md} RENAMED
@@ -1,149 +0,0 @@
1
- #### Modifiers <a id="forwardlist.modifiers">[[forwardlist.modifiers]]</a>
2
-
3
- None of the overloads of `insert_after` shall affect the validity of
4
- iterators and references, and `erase_after` shall invalidate only
5
- iterators and references to the erased elements. If an exception is
6
- thrown during `insert_after` there shall be no effect. Inserting `n`
7
- elements into a `forward_list` is linear in `n`, and the number of calls
8
- to the copy or move constructor of `T` is exactly equal to `n`. Erasing
9
- `n` elements from a `forward_list` is linear in `n` and the number of
10
- calls to the destructor of type `T` is exactly equal to `n`.
11
-
12
- ``` cpp
13
- template<class... Args> reference emplace_front(Args&&... args);
14
- ```
15
-
16
- *Effects:* Inserts an object of type `value_type` constructed with
17
- `value_type(std::forward<Args>(args)...)` at the beginning of the list.
18
-
19
- ``` cpp
20
- void push_front(const T& x);
21
- void push_front(T&& x);
22
- ```
23
-
24
- *Effects:* Inserts a copy of `x` at the beginning of the list.
25
-
26
- ``` cpp
27
- void pop_front();
28
- ```
29
-
30
- *Effects:* As if by `erase_after(before_begin())`.
31
-
32
- ``` cpp
33
- iterator insert_after(const_iterator position, const T& x);
34
- iterator insert_after(const_iterator position, T&& x);
35
- ```
36
-
37
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
38
- iterator in the range \[`begin()`, `end()`).
39
-
40
- *Effects:* Inserts a copy of `x` after `position`.
41
-
42
- *Returns:* An iterator pointing to the copy of `x`.
43
-
44
- ``` cpp
45
- iterator insert_after(const_iterator position, size_type n, const T& x);
46
- ```
47
-
48
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
49
- iterator in the range \[`begin()`, `end()`).
50
-
51
- *Effects:* Inserts `n` copies of `x` after `position`.
52
-
53
- *Returns:* An iterator pointing to the last inserted copy of `x` or
54
- `position` if `n == 0`.
55
-
56
- ``` cpp
57
- template<class InputIterator>
58
- iterator insert_after(const_iterator position, InputIterator first, InputIterator last);
59
- ```
60
-
61
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
62
- iterator in the range \[`begin()`, `end()`). Neither `first` nor `last`
63
- are iterators in `*this`.
64
-
65
- *Effects:* Inserts copies of elements in \[`first`, `last`) after
66
- `position`.
67
-
68
- *Returns:* An iterator pointing to the last inserted element or
69
- `position` if `first == last`.
70
-
71
- ``` cpp
72
- iterator insert_after(const_iterator position, initializer_list<T> il);
73
- ```
74
-
75
- *Effects:* `insert_after(p, il.begin(), il.end())`.
76
-
77
- *Returns:* An iterator pointing to the last inserted element or
78
- `position` if `il` is empty.
79
-
80
- ``` cpp
81
- template<class... Args>
82
- iterator emplace_after(const_iterator position, Args&&... args);
83
- ```
84
-
85
- *Preconditions:* `position` is `before_begin()` or is a dereferenceable
86
- iterator in the range \[`begin()`, `end()`).
87
-
88
- *Effects:* Inserts an object of type `value_type` constructed with
89
- `value_type(std::forward<Args>(args)...)` after `position`.
90
-
91
- *Returns:* An iterator pointing to the new object.
92
-
93
- ``` cpp
94
- iterator erase_after(const_iterator position);
95
- ```
96
-
97
- *Preconditions:* The iterator following `position` is dereferenceable.
98
-
99
- *Effects:* Erases the element pointed to by the iterator following
100
- `position`.
101
-
102
- *Returns:* An iterator pointing to the element following the one that
103
- was erased, or `end()` if no such element exists.
104
-
105
- *Throws:* Nothing.
106
-
107
- ``` cpp
108
- iterator erase_after(const_iterator position, const_iterator last);
109
- ```
110
-
111
- *Preconditions:* All iterators in the range (`position`, `last`) are
112
- dereferenceable.
113
-
114
- *Effects:* Erases the elements in the range (`position`, `last`).
115
-
116
- *Returns:* `last`.
117
-
118
- *Throws:* Nothing.
119
-
120
- ``` cpp
121
- void resize(size_type sz);
122
- ```
123
-
124
- *Preconditions:* `T` is *Cpp17DefaultInsertable* into `*this`.
125
-
126
- *Effects:* If `sz < distance(begin(), end())`, erases the last
127
- `distance(begin(), end()) - sz` elements from the list. Otherwise,
128
- inserts `sz - distance(begin(), end())` default-inserted elements at the
129
- end of the list.
130
-
131
- ``` cpp
132
- void resize(size_type sz, const value_type& c);
133
- ```
134
-
135
- *Preconditions:* `T` is *Cpp17CopyInsertable* into `*this`.
136
-
137
- *Effects:* If `sz < distance(begin(), end())`, erases the last
138
- `distance(begin(), end()) - sz` elements from the list. Otherwise,
139
- inserts `sz - distance(begin(), end())` copies of `c` at the end of the
140
- list.
141
-
142
- ``` cpp
143
- void clear() noexcept;
144
- ```
145
-
146
- *Effects:* Erases all elements in the range \[`begin()`, `end()`).
147
-
148
- *Remarks:* Does not invalidate past-the-end iterators.
149
-