std::list<T,Allocator>::push_back - cppreference.com (original) (raw)
| void push_back( const T& value ); | (1) | (constexpr since C++26) |
|---|---|---|
| void push_back( T&& value ); | (2) | (since C++11) (constexpr since C++26) |
Appends a copy of value to the end of the container.
No iterators or references are invalidated.
[edit] Parameters
| value | - | the value of the element to append |
|---|
| Type requirements -If the following condition is met, the behavior is undefined: | (since C++11) |
|---|
[edit] Complexity
Constant.
[edit] Exceptions
If an exception is thrown (which can be due to Allocator::allocate() or element copy/move constructor/assignment), this function has no effect (strong exception guarantee).
[edit] Example
Possible output:
std::list letters holds: "abc" "def" Moved-from string s holds: ""