std::forward_list::front

reference front(); (since C++11) const_reference front() const; (since C++11) 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::forward_list<char>: #include <fo

std::forward_list::insert_after

iterator insert_after( const_iterator pos, const T& value ); (1) (since C++11) iterator insert_after( const_iterator pos, T&& value ); (2) (since C++11) iterator insert_after( const_iterator pos, size_type count, const T& value ); (3) (since C++11) template< class InputIt > iterator insert_after( const_iterator pos, InputIt first, InputIt last ); (4) (since C++11) iterator insert_after( const_iterator pos, std::initializer_list<T> ilist );

std::forward_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 -

std::forward_list::begin

iterator begin(); (since C++11) const_iterator begin() const; (since C++11) const_iterator cbegin() const; (since C++11) Returns an iterator to the first element of the container. If the container is empty, the returned iterator will be equal to end(). Parameters (none). Return value Iterator to the first element. Exceptions noexcept specification: noexcept Complexity Constant. Example See also end cend returns an iterator to the end (public member

std::forward_list::before_begin

iterator before_begin(); (since C++11) const_iterator before_begin() const; (since C++11) const_iterator cbefore_begin() const; (since C++11) Returns an iterator to the element before the first element of the container. This element acts as a placeholder, attempting to access it results in undefined behavior. The only usage cases are in functions insert_after(), emplace_after(), erase_after(), splice_after() and the increment operator: incrementing the before-begin iterator

std::forward_list::empty

bool empty() const; (since C++11) 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 noexcept specification: noexcept Complexity Constant. Example The following code uses empty to check if a std::forward_list<int> contains any elements: #include <forward_list> #include <iostream> int main() { std::forward_list<int> numbers;

std::forward_list::emplace_after

template< class... Args > iterator emplace_after( const_iterator pos, Args&&... args ); (since C++11) Inserts a new element into a position after the specified position in the container. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element is called with exactly the same arguments, as supplied to the function. No iterators or references are invalidated. Parameters pos - iterator after which the new elem

std::forward_list::clear

void clear(); (since C++11) Removes all elements from the container. Invalidates any references, pointers, or iterators referring to contained elements. May invalidate any past-the-end iterators. Parameters (none). Return value (none). Exceptions noexcept specification: noexcept Complexity Linear in the size of the container. clear is defined in terms of erase, which has linear complexity. (until C++11) complexity of clear is omitted (since C++11)(until C++14) clea

std::forward_list::end

iterator end(); (since C++11) const_iterator end() const; (since C++11) 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 noexcept specification: noexcept Complexity Constant. See also begin cbegin

std::forward_list

Defined in header <forward_list> template< class T, class Allocator = std::allocator<T> > class forward_list; (since C++11) std::forward_list is a container that supports fast insertion and removal of elements from anywhere in the container. Fast random access is not supported. It is implemented as a singly-linked list and essentially does not have any overhead compared to its implementation in C. Compared to std::list this container provides more space