std::deque::get_allocator

allocator_type get_allocator() const; Returns the allocator associated with the container. Parameters (none). Return value The associated allocator. Complexity Constant.

std::deque::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::deque<char>: #include <deque> #include <iostream>

std::deque::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). All iterators and references are invalidated, unless the erased elements are at the end or the be

std::deque::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::deque::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::deque<int> contains any elements: #include <deque> #include <iostream> int main() { std::deque<int> numbers;

std::deque::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).... Parameters args - arguments to forward to the constructor of

std::deque::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).... All iterators, including the past-the-end iterator, are invalidated. No ref

std::deque::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).... All iterators, including the past-the-end iter

std::deque::deque

(1) explicit deque( const Allocator& alloc = Allocator() ); (until C++14) deque() : deque( Allocator() ) {} explicit deque( const Allocator& alloc ); (since C++14) (2) explicit deque( size_type count, const T& value = T(), const Allocator& alloc = Allocator()); (until C++11) deque( size_type count, const T& value, const Allocator& alloc = Allocator()); (since C++11) (3)

std::deque::clear

void clear(); 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 (none) (until C++11) noexcept specification: noexcept (since C++11) 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++