deque

deque

allocator_type·assign·at·back·begin·clear·const_iterator·const_reference ·const_reverse_iterator·deque·difference_type·empty·end·erase·front ·get_allocator·insert·iterator·max_size·operator[]·pop_back·pop_front ·push_back·push_front·rbegin·reference·rend·resize·reverse_iterator·size ·size_type·swap·value_type

  template<class T, class A = allocator<T> >
    class deque {
public:
    typedef A allocator_type;
    typedef A::size_type size_type;
    typedef A::difference_type difference_type;
    typedef A::reference reference;
    typedef A::const_reference const_reference;
    typedef A::value_type value_type;
    typedef T0 iterator;
    typedef T1 const_iterator;
    typedef reverse_iterator<iterator, value_type,
        reference, A::pointer, difference_type>
reverse_iterator;
    typedef reverse_iterator<const_iterator, value_type,
        const_reference, A::const_pointer, difference_type>
const_reverse_iterator;
    explicit deque(const A& al = A());
    explicit deque(size_type n, const T& v = T(), const A& al = A());
deque(const deque& x);
deque(const_iterator first, const_iterator last,
        const A& al = A());
    iterator begin();
    const_iterator begin() const;
    iterator end();
    iterator end() const;
    reverse_iterator rbegin();
    const_reverse_iterator rbegin() const;
    reverse_iterator rend();
    const_reverse_iterator rend() const;
    void resize(size_type n, T x = T());
    size_type size() const;
    size_type max_size() const;
    bool empty() const;
    A get_allocator() const;
    reference at(size_type pos);
    const_reference at(size_type pos) const;
    reference operator[](size_type pos);
    const_reference operator[](size_type pos);
    reference front();
    const_reference front() const;
    reference back();
    const_reference back() const;
    void push_front(const T& x);
    void pop_front();
    void push_back(const T& x);
    void pop_back();
    void assign(const_iterator first, const_iterator last);
    void assign(size_type n, const T& x = T());
    iterator insert(iterator it, const T& x = T());
    void insert(iterator it, size_type n, const T& x);
    void insert(iterator it,
        const_iterator first, const_iterator last);
    iterator erase(iterator it);
    iterator erase(iterator first, iterator last);
    void clear();
    void swap(deque x);
protected:
    A allocator;
    };

The template class describes an object that controls a varying-length sequence of elements of type T. The sequence is represented in a way that permits insertion and removal of an element at either end with a single element copy (constant time). Such operations in the middle of the sequence require element copies and assignments proportional to the number of elements in the sequence (linear time).

The object allocates and frees storage for the sequence it controls through a protected object named allocator, of class A. Such an allocator object must have the same external interface as an object of template class allocator. Note that allocator is not copied when the object is assigned.

Deque reallocation occurs when a member function must insert or erase elements of the controlled sequence. In all such cases, iterators or references that point anywhere within the controlled sequence become invalid.