C++-Referenz/ Standardbibliothek/ Container-Klassen/ deque
Erscheinungsbild
Alte Seite
Die Arbeit am Buch »C++-Referenz« wurde vom Hauptautor eingestellt. Ein Lehrbuch zum Thema C++ ist unter »C++-Programmierung« zu finden. Eine sehr umfangreiche und gute Referenz gibt es unter cppreference.com.
Diese Seite beschreibt C++98, einen stark veralteten Standard. Aktuelle Referenz.
// Header: deque
template <typename T, typename Allocator = allocator<T> >
class deque{
public:
typedef typename Allocator::reference reference;
typedef typename Allocator::const_reference const_reference;
typedef implementation defined iterator;
typedef implementation defined const_iterator;
typedef typename Allocator::size_type size_type;
typedef typename Allocator::difference_type difference_type;
typedef T value_type;
typedef Allocator allocator_type;
typedef typename Allocator::pointer pointer;
typedef typename Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Konstruktoren, Destruktor, Kopieren
explicit deque(Allocator const& = Allocator());
explicit deque(size_type n, T const& value = T(), Allocator const& = Allocator());
template <typename InputIterator>
deque(InputIterator first, InputIterator last, Allocator const& = Allocator());
deque(deque<T,Allocator> const& x);
~deque();
deque<T,Allocator>& operator=(deque<T,Allocator> const& x);
template <typename InputIterator> void assign(InputIterator first, InputIterator last);
template <typename Size, typename T> void assign(Size n, T const& t = T());
allocator_type get_allocator()const;
// Iteratoren
iterator begin();
const_iterator begin()const;
iterator end();
const_iterator end()const;
reverse_iterator rbegin();
const_reverse_iterator rbegin()const;
reverse_iterator rend();
const_reverse_iterator rend()const;
// Kapazität
size_type size()const;
size_type max_size()const;
bool empty()const;
void resize(size_type sz, T c = T());
// Elementzugriff
reference operator[](size_type n);
const_reference operator[](size_type n)const;
reference at(size_type n);
const_reference at(size_type n)const;
reference front();
const_reference front()const;
reference back();
const_reference back()const;
// Modifizierer
void push_front(T const& x);
void pop_front();
void push_back(T const& x);
void pop_back();
iterator insert(iterator position, T const& x = T());
void insert(iterator position, size_type n, T const& x);
template <typename InputIterator>
void insert (iterator position, InputIterator first, InputIterator last);
iterator erase(iterator position);
iterator erase(iterator first, iterator last);
void swap(deque<T,Allocator>&);
void clear();
};
// Vergleiche
template <typename T, typename Allocator>
bool operator==(deque<T,Allocator> const& x, deque<T,Allocator> const& y);
template <typename T, typename Allocator>
bool operator< (deque<T,Allocator> const& x, deque<T,Allocator> const& y);
template <typename T, typename Allocator>
bool operator!=(deque<T,Allocator> const& x, deque<T,Allocator> const& y);
template <typename T, typename Allocator>
bool operator> (deque<T,Allocator> const& x, deque<T,Allocator> const& y);
template <typename T, typename Allocator>
bool operator>=(deque<T,Allocator> const& x, deque<T,Allocator> const& y);
template <typename T, typename Allocator>
bool operator<=(deque<T,Allocator> const& x, deque<T,Allocator> const& y);
// Spezialisierte Algorithmen
template <typename T, typename Allocator>
void swap(deque<T,Allocator>& x, deque<T,Allocator>& y);