From Jason Turner

[inplace.vector.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkpgp3nqt/{from.md → to.md} +138 -0
tmp/tmpkpgp3nqt/{from.md → to.md} RENAMED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Modifiers <a id="inplace.vector.modifiers">[[inplace.vector.modifiers]]</a>
2
+
3
+ ``` cpp
4
+ constexpr iterator insert(const_iterator position, const T& x);
5
+ constexpr iterator insert(const_iterator position, T&& x);
6
+ constexpr iterator insert(const_iterator position, size_type n, const T& x);
7
+ template<class InputIterator>
8
+ constexpr iterator insert(const_iterator position, InputIterator first, InputIterator last);
9
+ template<container-compatible-range<T> R>
10
+ constexpr iterator insert_range(const_iterator position, R&& rg);
11
+ constexpr iterator insert(const_iterator position, initializer_list<T> il);
12
+
13
+ template<class... Args>
14
+ constexpr iterator emplace(const_iterator position, Args&&... args);
15
+ template<container-compatible-range<T> R>
16
+ constexpr void append_range(R&& rg);
17
+ ```
18
+
19
+ Let n be the value of `size()` before this call for the `append_range`
20
+ overload, and `distance(begin, position)` otherwise.
21
+
22
+ *Complexity:* Linear in the number of elements inserted plus the
23
+ distance to the end of the vector.
24
+
25
+ *Remarks:* If an exception is thrown other than by the copy constructor,
26
+ move constructor, assignment operator, or move assignment operator of
27
+ `T` or by any `InputIterator` operation, there are no effects.
28
+ Otherwise, if an exception is thrown, then `size()` ≥ n and elements in
29
+ the range `begin() + ``[``0, `n`)` are not modified.
30
+
31
+ ``` cpp
32
+ constexpr reference push_back(const T& x);
33
+ constexpr reference push_back(T&& x);
34
+ template<class... Args>
35
+ constexpr reference emplace_back(Args&&... args);
36
+ ```
37
+
38
+ *Returns:* `back()`.
39
+
40
+ *Throws:* `bad_alloc` or any exception thrown by the initialization of
41
+ the inserted element.
42
+
43
+ *Complexity:* Constant.
44
+
45
+ *Remarks:* If an exception is thrown, there are no effects on `*this`.
46
+
47
+ ``` cpp
48
+ template<class... Args>
49
+ constexpr pointer try_emplace_back(Args&&... args);
50
+ constexpr pointer try_push_back(const T& x);
51
+ constexpr pointer try_push_back(T&& x);
52
+ ```
53
+
54
+ Let `vals` denote a pack:
55
+
56
+ - `std::forward<Args>(args)...` for the first overload,
57
+ - `x` for the second overload,
58
+ - `std::move(x)` for the third overload.
59
+
60
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
61
+ `inplace_vector` from `vals...`.
62
+
63
+ *Effects:* If `size() < capacity()` is `true`, appends an object of type
64
+ `T` direct-non-list-initialized with `vals...`. Otherwise, there are no
65
+ effects.
66
+
67
+ *Returns:* `nullptr` if `size() == capacity()` is `true`, otherwise
68
+ `addressof(back())`.
69
+
70
+ *Throws:* Nothing unless an exception is thrown by the initialization of
71
+ the inserted element.
72
+
73
+ *Complexity:* Constant.
74
+
75
+ *Remarks:* If an exception is thrown, there are no effects on `*this`.
76
+
77
+ ``` cpp
78
+ template<container-compatible-range<T> R>
79
+ constexpr ranges::borrowed_iterator_t<R> try_append_range(R&& rg);
80
+ ```
81
+
82
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
83
+ `inplace_vector` from
84
+ `*ranges::begin(rg)`.
85
+
86
+ *Effects:* Appends copies of initial elements in `rg` before `end()`,
87
+ until all elements are inserted or `size() == capacity()` is `true`.
88
+ Each iterator in the range `rg` is dereferenced at most once.
89
+
90
+ *Returns:* The first iterator in the range `ranges::begin(rg)`+\[0, `n`)
91
+ that was not inserted into `*this`, where `n` is the number of elements
92
+ in `rg`.
93
+
94
+ *Complexity:* Linear in the number of elements inserted.
95
+
96
+ *Remarks:* Let n be the value of `size()` prior to this call. If an
97
+ exception is thrown after the insertion of k elements, then `size()`
98
+ equals n + k, elements in the range `begin() + ``[``0, `n`)` are not
99
+ modified, and elements in the range `begin() + ``[`n`, `n + k`)`
100
+ correspond to the inserted elements.
101
+
102
+ ``` cpp
103
+ template<class... Args>
104
+ constexpr reference unchecked_emplace_back(Args&&... args);
105
+ ```
106
+
107
+ *Preconditions:* `size() < capacity()` is `true`.
108
+
109
+ *Effects:* Equivalent to:
110
+ `return *try_emplace_back(std::forward<Args>(args)...);`
111
+
112
+ ``` cpp
113
+ constexpr reference unchecked_push_back(const T& x);
114
+ constexpr reference unchecked_push_back(T&& x);
115
+ ```
116
+
117
+ *Preconditions:* `size() < capacity()` is `true`.
118
+
119
+ *Effects:* Equivalent to:
120
+ `return *try_push_back(std::forward<decltype(x)>(x));`
121
+
122
+ ``` cpp
123
+ constexpr iterator erase(const_iterator position);
124
+ constexpr iterator erase(const_iterator first, const_iterator last);
125
+ constexpr void pop_back();
126
+ ```
127
+
128
+ *Effects:* Invalidates iterators and references at or after the point of
129
+ the erase.
130
+
131
+ *Throws:* Nothing unless an exception is thrown by the assignment
132
+ operator or move assignment operator of `T`.
133
+
134
+ *Complexity:* The destructor of `T` is called the number of times equal
135
+ to the number of the elements erased, but the assignment operator of `T`
136
+ is called the number of times equal to the number of elements after the
137
+ erased elements.
138
+