public member function
<stack>
std::stack::emplace
template <class... Args> void emplace (Args&&... args);
Construct and insert element
This member function effectively calls the member function emplace_back of the underlying container, forwarding args.
Parameters
- args
- Arguments forwarded to construct the new element.
Return value
noneExample
|
|
Output:
mystack contains: Second sentence First sentence
Complexity
One call to emplace_back on the underlying container.Data races
The container and up to all its contained elements are modified.Exception safety
Provides the same level of guarantees as the operation performed on the underlying container object.See also
- stack::push
- Insert element (public member function)
- stack::pop
- Remove top element (public member function)