Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/container/push front"

From cppreference.com
(exception guarantees)
(Deque and list have different push_front complexities. Deque conceptually has a vector of arrays, whereas list is a linked list.)
Line 23: Line 23:
  
 
===Complexity===
 
===Complexity===
Constant.
+
{{#switch:{{{1|}}}
 +
| deque = Amortized constant.
 +
| list = Constant.
 +
| {{included}}
 +
}}
  
 
===Exceptions===
 
===Exceptions===

Revision as of 21:43, 18 January 2017

void push_front( const T& value );
(since {std})
void push_front( T&& value );
(since C++11)

Prepends the given element value to the beginning of the container.

Contents

Parameters

value - the value of the element to prepend

Return value

(none)

Complexity

Exceptions

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

See also

constructs an element in-place at the beginning
(public member function of std::{{{1}}}) [edit]
adds an element to the end
(public member function of std::{{{1}}}) [edit]
removes the first element
(public member function of std::{{{1}}}) [edit]