std::list::front

reference front(); const_reference front() const; Returns a reference to the first element in the container. Calling front on an empty container is undefined. Parameters (none). Return value reference to the first element. Complexity Constant. Notes For a container c, the expression c.front() is equivalent to *c.begin(). Example The following code uses front to display the first element of a std::list<char>: #include <list> #include <iostream> i

std::list::merge

void merge( list& other ); (1) void merge( list&& other ); (1) (since C++11) template <class Compare> void merge( list& other, Compare comp ); (2) template <class Compare> void merge( list&& other, Compare comp ); (2) (since C++11) Merges two sorted lists into one. The lists should be sorted into ascending order. No elements are copied. The container other becomes empty after the operation. The function does nothing if this == &

std::list::insert

(1) iterator insert( iterator pos, const T& value ); (until C++11) iterator insert( const_iterator pos, const T& value ); (since C++11) iterator insert( const_iterator pos, T&& value ); (2) (since C++11) (3) void insert( iterator pos, size_type count, const T& value ); (until C++11) iterator insert( const_iterator pos, size_type count, const T& value ); (since C++11) (4) template< class InputIt > void insert( iterator pos, InputIt f

std::list::max_size

size_type max_size() const; Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. Parameters (none). Return value Maximum number of elements. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Notes This value is typically equal to std::numeric_limits<size_type>::max(), and reflects the

std::list::emplace

template< class... Args > iterator emplace( const_iterator pos, Args&&... args ); (since C++11) Inserts a new element into the container directly before pos. The element is constructed through std::allocator_traits::construct, which typically uses placement-new to construct the element in-place at a location provided by the container. The arguments args... are forwarded to the constructor as std::forward<Args>(args).... No iterators or references are invalidated.

std::list::erase

(1) iterator erase( iterator pos ); (until C++11) iterator erase( const_iterator pos ); (since C++11) (2) iterator erase( iterator first, iterator last ); (until C++11) iterator erase( const_iterator first, const_iterator last ); (since C++11) Removes specified elements from the container. 1) Removes the element at pos. 2) Removes the elements in the range [first; last). References and iterators to the erased elements are invalidated. Other references and iterators a

std::list::end

iterator end(); const_iterator end() const; const_iterator cend() const; (since C++11) Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior. Parameters (none). Return value Iterator to the element following the last element. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. See also begin

std::list::empty

bool empty() const; Checks if the container has no elements, i.e. whether begin() == end(). Parameters (none). Return value true if the container is empty, false otherwise. Exceptions (none) (until C++11) noexcept specification: noexcept (since C++11) Complexity Constant. Example The following code uses empty to check if a std::list<int> contains any elements: #include <list> #include <iostream> int main() { std::list<int> numbers; s

std::list::emplace_back

template< class... Args > void emplace_back( Args&&... args ); (since C++11) Appends a new element to the end 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).... No iterators or references are invalidated. Parameters args - argum

std::list::emplace_front

template< class... Args > void emplace_front( Args&&... args ); (since C++11) 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).... No iterators or references are invalidated. Parameters args -