GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::forward_list::push_front(3) C++ Standard Libary std::forward_list::push_front(3)

std::forward_list::push_front - std::forward_list::push_front


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


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


No iterators or references are invalidated.


value - the value of the element to prepend


(none)


Constant.


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

// Run this code


#include <forward_list>
#include <iostream>
#include <iomanip>
#include <string>


int main()
{
std::forward_list<std::string> letters;


letters.push_front("abc");
std::string s{"def"};
letters.push_front(std::move(s));


std::cout << "std::forward_list `letters` holds: ";
for (auto&& e : letters) std::cout << std::quoted(e) << ' ';


std::cout << "\nMoved-from string `s` holds: " << std::quoted(s) << '\n';
}


std::forward_list `letters` holds: "def" "abc"
Moved-from string `s` holds: ""


emplace_front constructs an element in-place at the beginning
(C++11) (public member function)
pop_front removes the first element
(C++11) (public member function)
creates a std::front_insert_iterator of type inferred from the
front_inserter argument
(function template)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.