Namespaces
Variants
Actions

std::inplace_vector<T,N>::try_push_back

From cppreference.com
 
 
 
 
constexpr pointer try_push_back( const T& value );
(1) (since C++26)
constexpr pointer try_push_back( T&& value );
(2) (since C++26)

Conditionally appends the given element value to the end of the container.

If size() == capacity() is true, there are no effects. Otherwise, appends an object of type T:

1) The new element is initialized as a copy of value.
2) value is moved into the new element.

No iterators or references are invalidated, except end(), which is invalidated if the insertion occurs.

Contents

[edit] Parameters

value - the value of the element to append
Type requirements
-
T must meet the requirements of EmplaceConstructible.

[edit] Return value

std::addressof(back()) if size() < capacity(), nullptr otherwise.

[edit] Complexity

Constant.

[