std::forward_list emplace_front() method
- od C++17
- od C++11
// Non const version only
template< class... Args >
reference emplace_front( Args&&... args );
// Non const version only
template< class... Args >
void emplace_front( Args&&... args );
Inserts a new element to the beginning of the container.
The element is constructed through std::allocator_traits::construct
, which typically uses placement-new to construct the element in-place at the location provided by the container.
The arguments args...
are forwarded to the constructor as std::forward<Args>(args)...
.
Parameters
args
- arguments to forward to the constructor of the element
Type requirements
T
(the container's element type) must meet the requirements ofEmplaceConstructible
.
Return value
A reference to the inserted element. (od C++17)(none) (do C++17)
Complexity
Constant - O(1).
Exceptions
If an exception is thrown, this function has no effect (strong exception guarantee).
Example
This section requires improvement. You can help by editing this doc page.
Hover to see the original license.