Same level pages:
Vector Deque List Set Multiset Map Multimap String Bitset Stack Queue Priority Queue
Parent level pages:
Containers Classes Iterators Algorithms
| |
A deque is a random access container that is both a front insertion sequence and a back
insertion sequence. A simplified declaration for an STL deque template
would look something like: template<class T>
class deque
{
public:
deque();
deque(unsigned n, const T& v = T());
deque(const deque& x);
void resize(unsigned n, T x = T());
unsigned size() const;
unsigned max_size() const;
bool empty() const;
T& operator[](unsigned pos);
const T& operator[](unsigned pos);
T& front();
const T& front() const;
T& back();
const T& back() const;
void push_front(const T& x);
void pop_front();
void push_back(const T& x);
void pop_back();
void assign(size_type n, const T& x = T());
void clear();
void swap(deque x);
protected:
A allocator;
};
The full declaration for the STL deque template looks
something like:
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;
};
|