...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Append a constructed element in-place.
template<
class Arg>
value
&
emplace_back(
Arg&& arg);
Appends a new element to the end of the container's list of elements. The
element is constructed using placement-new with the parameter std::forward<Arg>(arg)
.
If capacity()
< size() + 1
,
a reallocation occurs first, and all iterators and references are invalidated.
Otherwise, only the iterators and references from the insertion point forward
are invalidated. All past-the-end iterators are also invalidated.
Amortized constant.
Strong guarantee. Calls to memory_resource::allocate
may throw.
Name |
Description |
---|---|
|
The argument to forward to the |
A reference to the inserted element