(C++17) | ||||
| Sequence | ||||
(C++11) | ||||
(C++26) | ||||
(C++26) | ||||
(C++11) | ||||
| Associative | ||||
| Unordered associative | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Adaptors | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
| Views | ||||
(C++20) | ||||
(C++23) | ||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
constexpr reference unchecked_push_back(const T& value); | (1) | (since C++26) |
constexpr reference unchecked_push_back( T&& value); | (2) | (since C++26) |
Appends the given elementvalue to the end of the container.
Equivalent to:return*try_push_back(std::forward<decltype(value)>(value));
Before the call to these functionssize()< capacity() must betrue. Otherwise, the behavior is undefined.
No iterators or references are invalidated, exceptend(), which is invalidated if the insertion occurs.
Contents |
| value | - | the value of the element to append |
| Type requirements | ||
-T must meet the requirements ofCopyInsertable in order to use overload (1). | ||
-T must meet the requirements ofMoveInsertable in order to use overload (2). | ||
back(), i.e. a reference to the inserted element.
Constant.
Any exception thrown by initialization of inserted element.
If an exception is thrown for any reason, these functions have no effect (strong exception safety guarantee).
| This section is incomplete Reason: Explain the purpose of this API. |
#include <cassert>#include <inplace_vector>#include <string> int main(){std::inplace_vector<std::string,2> fauna;std::string dog{"dog"}; auto& r1= fauna.unchecked_push_back("cat");// overload (1)assert(r1=="cat" and fauna.size()==1);auto& r2= fauna.unchecked_push_back(std::move(dog));// overload (2)assert(r2=="dog" and fauna.size()==2);assert(fauna[0]=="cat" and fauna[1]=="dog");// fauna.unchecked_push_back("bug"); // undefined behavior: there is no space}
| adds an element to the end (public member function)[edit] | |
| constructs an element in-place at the end (public member function)[edit] | |
| adds a range of elements to the end (public member function)[edit] | |
| tries to add an element to the end (public member function)[edit] | |
| tries to construct an element in-place at the end (public member function)[edit] | |
| tries to add a range of elements to the end (public member function)[edit] | |
| unconditionally constructs an element in-place at the end (public member function)[edit] | |
| removes the last element (public member function)[edit] | |
| creates astd::back_insert_iterator of type inferred from the argument (function template)[edit] |