Skip to main content

std::deque emplace_front() method

template< class... Args >
reference emplace_front( Args&&... args );

Prepends a new element at the beginnign of the container.
The element is constructed through std::allocator_traits<Alloc>::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)....

Invalidation

All iterators, including the past-the-end iterator, are invalidated.
No references are invalidated.

Parameters

  • args - arguments to forward to the constructor of the element

Type requirements

Return value

A reference to the inserted element.

Complexity

Constant - O(1).

Exceptions

If an exception is thrown, this function has no effect (strong exception guarantee).

Example

important

This section requires improvement. You can help by editing this doc page.

This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.

std::deque emplace_front() method

template< class... Args >
reference emplace_front( Args&&... args );

Prepends a new element at the beginnign of the container.
The element is constructed through std::allocator_traits<Alloc>::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)....

Invalidation

All iterators, including the past-the-end iterator, are invalidated.
No references are invalidated.

Parameters

  • args - arguments to forward to the constructor of the element

Type requirements

Return value

A reference to the inserted element.

Complexity

Constant - O(1).

Exceptions

If an exception is thrown, this function has no effect (strong exception guarantee).

Example

important

This section requires improvement. You can help by editing this doc page.

This article originates from this CppReference page. It was likely altered for improvements or editors' preference. Click "Edit this page" to see all changes made to this document.
Hover to see the original license.