![]() |
Home | Libraries | People | FAQ | More |
boost::container::deque
// In header: <boost/container/deque.hpp> template<typename T, typename Allocator = void, typename Options = void> class deque : protected { public: // types typedef T ; typedef ; typedef ::boost::container::allocator_traits< ; typedef ::boost::container::allocator_traits< ; typedef ::boost::container::allocator_traits< ; typedef ::boost::container::allocator_traits< ; typedef ::boost::container::allocator_traits< ; typedef ::boost::container::allocator_traits< ; typedef implementation_defined ; typedef implementation_defined ; typedef implementation_defined ; typedef implementation_defined ; typedef implementation_defined ; // construct/copy/destruct () ; (const ) ; (size_type); (size_type, default_init_t); (size_type, const ); (size_type, default_init_t, const ); (size_type, const value_type &); (size_type, const value_type &, const ); template<typename InIt> (InIt, InIt); template<typename InIt> (InIt, InIt, const ); (value_type >, const = ); (const deque &); (deque &&) ; (const deque &, const ); (deque &&, const ); deque & (const deque &); deque & (deque &&) ; deque & (value_type >); ~(); // public member functions void (size_type, const T &); template<typename InIt> void (InIt, InIt); void (value_type >); () ; const stored_allocator_type & () ; stored_allocator_type & () ; iterator () ; const_iterator () ; iterator () ; const_iterator () ; reverse_iterator () ; const_reverse_iterator () ; reverse_iterator () ; const_reverse_iterator () ; const_iterator () ; const_iterator () ; const_reverse_iterator () ; const_reverse_iterator () ; bool () ; size_type () ; size_type () ; void (size_type); void (size_type, default_init_t); void (size_type, const value_type &); void (); reference () ; const_reference () ; reference () ; const_reference () ; reference (size_type) ; const_reference (size_type) ; iterator (size_type) ; const_iterator (size_type) ; size_type (iterator) ; size_type (const_iterator) ; reference (size_type); const_reference (size_type) ; template< Args> reference (Args &&...); template< Args> reference (Args &&...); template< Args> iterator (const_iterator, Args &&...); void (const T &); void (T &&); void (const T &); void (T &&); iterator (const_iterator, const T &); iterator (const_iterator, T &&); iterator (const_iterator, size_type, const value_type &); template<typename InIt> iterator (const_iterator, InIt, InIt); iterator (const_iterator, value_type >); void () ; void () ; iterator (const_iterator) ; iterator (const_iterator, const_iterator) ; void (deque &) ; void () ; // friend functions bool (const deque &, const deque &); bool (const deque &, const deque &); bool (const deque &, const deque &); bool (const deque &, const deque &); bool (const deque &, const deque &); bool (const deque &, const deque &); void (deque &, deque &) ; };
A double-ended queue is a sequence that supports random access to elements, constant time insertion and removal of elements at the end of the sequence, and linear time insertion and removal of elements in the middle.
typename T
The type of object that is stored in the deque
typename Allocator = void
typename Options = void
A type produced from
. boost::container::deque_options
deque
public
construct/copy/destruct() ;
Effects: Default constructors a deque.
Throws: If allocator_type's default constructor throws.
Complexity: Constant.
(const a) ;
Effects: Constructs a deque taking the allocator as parameter.
Throws: Nothing
Complexity: Constant.
(size_type n);
Effects: Constructs a deque and inserts n value initialized values.
Throws: If allocator_type's default constructor throws or T's value initialization throws.
Complexity: Linear to n.
(size_type n, default_init_t);
Effects: Constructs a deque and inserts n default initialized values.
Throws: If allocator_type's default constructor throws or T's default initialization or copy constructor throws.
Complexity: Linear to n.
Note: Non-standard extension
(size_type n, const a);
Effects: Constructs a deque that will use a copy of allocator a and inserts n value initialized values.
Throws: If allocator_type's default constructor throws or T's value initialization throws.
Complexity: Linear to n.
(size_type n, default_init_t, const a);
Effects: Constructs a deque that will use a copy of allocator a and inserts n default initialized values.
Throws: If allocator_type's default constructor throws or T's default initialization or copy constructor throws.
Complexity: Linear to n.
Note: Non-standard extension
(size_type n, const value_type & value);
Effects: Constructs a deque that will use a copy of allocator a and inserts n copies of value.
Throws: If allocator_type's default constructor throws or T's copy constructor throws.
Complexity: Linear to n.
(size_type n, const value_type & value, const a);
Effects: Constructs a deque that will use a copy of allocator a and inserts n copies of value.
Throws: If allocator_type's default constructor throws or T's copy constructor throws.
Complexity: Linear to n.
template<typename InIt> (InIt first, InIt last);
Effects: Constructs a deque that will use a copy of allocator a and inserts a copy of the range [first, last) in the deque.
Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced InIt throws.
Complexity: Linear to the range [first, last).
template<typename InIt> (InIt first, InIt last, const a);
Effects: Constructs a deque that will use a copy of allocator a and inserts a copy of the range [first, last) in the deque.
Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced InIt throws.
Complexity: Linear to the range [first, last).
(value_type > il, const a = );
Effects: Constructs a deque that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the deque.
Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced std::initializer_list iterator throws.
Complexity: Linear to the range [il.begin(), il.end()).
(const deque & x);
Effects: Copy constructs a deque.
Postcondition: x == *this.
Complexity: Linear to the elements x contains.
(deque && x) ;
Effects: Move constructor. Moves x's resources to *this.
Throws: If allocator_type's copy constructor throws.
Complexity: Constant.
(const deque & x, const a);
Effects: Copy constructs a vector using the specified allocator.
Postcondition: x == *this.
Throws: If allocation throws or T's copy constructor throws.
Complexity: Linear to the elements x contains.
(deque && x, const a);
Effects: Move constructor using the specified allocator. Moves x's resources to *this if a == allocator_type(). Otherwise copies values from x to *this.
Throws: If allocation or T's copy constructor throws.
Complexity: Constant if a == x.get_allocator(), linear otherwise.
deque & (const deque & x);
Effects: Makes *this contain the same elements as x.
Postcondition: this->size() == x.size(). *this contains a copy of each of x's elements.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to the number of elements in x.
deque & (deque && x) ;
Effects: Move assignment. All x's values are transferred to *this.
Throws: If allocator_traits_type::propagate_on_container_move_assignment is false and (allocation throws or value_type's move constructor throws)
Complexity: Constant if allocator_traits_type:: propagate_on_container_move_assignment is true or this->get>allocator() == x.get_allocator(). Linear otherwise.
deque & (value_type > il);
Effects: Makes *this contain the same elements as il.
Postcondition: this->size() == il.size(). *this contains a copy of each of x's elements.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to the number of elements in il.
~();
Effects: Destroys the deque. All stored values are destroyed and used memory is deallocated.
Throws: Nothing.
Complexity: Linear to the number of elements.
deque
public member functionsvoid (size_type n, const T & val);
Effects: Assigns the n copies of val to *this.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
template<typename InIt> void (InIt first, InIt last);
Effects: Assigns the the range [first, last) to *this.
Throws: If memory allocation throws or T's constructor from dereferencing InIt throws.
Complexity: Linear to n.
void (value_type > il);
Effects: Assigns the the range [il.begin(), il.end()) to *this.
Throws: If memory allocation throws or T's constructor from dereferencing std::initializer_list iterator throws.
Complexity: Linear to il.size().
() ;
Effects: Returns a copy of the internal allocator.
Throws: If allocator's copy constructor throws.
Complexity: Constant.
const stored_allocator_type & () ;
Effects: Returns a reference to the internal allocator.
Throws: Nothing
Complexity: Constant.
Note: Non-standard extension.
stored_allocator_type & () ;
Effects: Returns a reference to the internal allocator.
Throws: Nothing
Complexity: Constant.
Note: Non-standard extension.
iterator () ;
Effects: Returns an iterator to the first element contained in the deque.
Throws: Nothing.
Complexity: Constant.
const_iterator () ;
Effects: Returns a const_iterator to the first element contained in the deque.
Throws: Nothing.
Complexity: Constant.
iterator () ;
Effects: Returns an iterator to the end of the deque.
Throws: Nothing.
Complexity: Constant.
const_iterator () ;
Effects: Returns a const_iterator to the end of the deque.
Throws: Nothing.
Complexity: Constant.
reverse_iterator () ;
Effects: Returns a reverse_iterator pointing to the beginning of the reversed deque.
Throws: Nothing.
Complexity: Constant.
const_reverse_iterator () ;
Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed deque.
Throws: Nothing.
Complexity: Constant.
reverse_iterator () ;
Effects: Returns a reverse_iterator pointing to the end of the reversed deque.
Throws: Nothing.
Complexity: Constant.
const_reverse_iterator () ;
Effects: Returns a const_reverse_iterator pointing to the end of the reversed deque.
Throws: Nothing.
Complexity: Constant.
const_iterator () ;
Effects: Returns a const_iterator to the first element contained in the deque.
Throws: Nothing.
Complexity: Constant.
const_iterator () ;
Effects: Returns a const_iterator to the end of the deque.
Throws: Nothing.
Complexity: Constant.
const_reverse_iterator () ;
Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed deque.
Throws: Nothing.
Complexity: Constant.
const_reverse_iterator () ;
Effects: Returns a const_reverse_iterator pointing to the end of the reversed deque.
Throws: Nothing.
Complexity: Constant.
bool () ;
Effects: Returns true if the deque contains no elements.
Throws: Nothing.
Complexity: Constant.
size_type () ;
Effects: Returns the number of the elements contained in the deque.
Throws: Nothing.
Complexity: Constant.
size_type () ;
Effects: Returns the largest possible size of the deque.
Throws: Nothing.
Complexity: Constant.
void (size_type new_size);
Effects: Inserts or erases elements at the end such that the size becomes n. New elements are value initialized.
Throws: If memory allocation throws, or T's constructor throws.
Complexity: Linear to the difference between size() and new_size.
void (size_type new_size, default_init_t);
Effects: Inserts or erases elements at the end such that the size becomes n. New elements are default initialized.
Throws: If memory allocation throws, or T's constructor throws.
Complexity: Linear to the difference between size() and new_size.
Note: Non-standard extension
void (size_type new_size, const value_type & x);
Effects: Inserts or erases elements at the end such that the size becomes n. New elements are copy constructed from x.
Throws: If memory allocation throws, or T's copy constructor throws.
Complexity: Linear to the difference between size() and new_size.
void ();
Effects: Tries to deallocate the excess of memory created with previous allocations. The size of the deque is unchanged
Throws: If memory allocation throws.
Complexity: Constant.
reference () ;
Requires: !empty()
Effects: Returns a reference to the first element of the container.
Throws: Nothing.
Complexity: Constant.
const_reference () ;
Requires: !empty()
Effects: Returns a const reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
reference () ;
Requires: !empty()
Effects: Returns a reference to the last element of the container.
Throws: Nothing.
Complexity: Constant.
const_reference () ;
Requires: !empty()
Effects: Returns a const reference to the last element of the container.
Throws: Nothing.
Complexity: Constant.
reference (size_type n) ;
Requires: size() > n.
Effects: Returns a reference to the nth element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
const_reference (size_type n) ;
Requires: size() > n.
Effects: Returns a const reference to the nth element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
iterator (size_type n) ;
Requires: size() >= n.
Effects: Returns an iterator to the nth element from the beginning of the container. Returns end() if n == size().
Throws: Nothing.
Complexity: Constant.
Note: Non-standard extension
const_iterator (size_type n) ;
Requires: size() >= n.
Effects: Returns a const_iterator to the nth element from the beginning of the container. Returns end() if n == size().
Throws: Nothing.
Complexity: Constant.
Note: Non-standard extension
size_type (iterator p) ;
Requires: begin() <= p <= end().
Effects: Returns the index of the element pointed by p and size() if p == end().
Throws: Nothing.
Complexity: Constant.
Note: Non-standard extension
size_type (const_iterator p) ;
Requires: begin() <= p <= end().
Effects: Returns the index of the element pointed by p and size() if p == end().
Throws: Nothing.
Complexity: Constant.
Note: Non-standard extension
reference (size_type n);
Requires: size() > n.
Effects: Returns a reference to the nth element from the beginning of the container.
Throws: range_error if n >= size()
Complexity: Constant.
const_reference (size_type n) ;
Requires: size() > n.
Effects: Returns a const reference to the nth element from the beginning of the container.
Throws: range_error if n >= size()
Complexity: Constant.
template< Args> reference (Args &&... args);
Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the beginning of the deque.
Returns: A reference to the created object.
Throws: If memory allocation throws or the in-place constructor throws.
Complexity: Amortized constant time
template< Args> reference (Args &&... args);
Effects: Inserts an object of type T constructed with std::forward<Args>(args)... in the end of the deque.
Returns: A reference to the created object.
Throws: If memory allocation throws or the in-place constructor throws.
Complexity: Amortized constant time
template< Args> iterator (const_iterator p, Args &&... args);
Requires: p must be a valid iterator of *this.
Effects: Inserts an object of type T constructed with std::forward<Args>(args)... before p
Throws: If memory allocation throws or the in-place constructor throws.
Complexity: If p is end(), amortized constant time Linear time otherwise.
void (const T & x);
Effects: Inserts a copy of x at the front of the deque.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Amortized constant time.
void (T && x);
Effects: Constructs a new element in the front of the deque and moves the resources of x to this new element.
Throws: If memory allocation throws.
Complexity: Amortized constant time.
void (const T & x);
Effects: Inserts a copy of x at the end of the deque.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Amortized constant time.
void (T && x);
Effects: Constructs a new element in the end of the deque and moves the resources of x to this new element.
Throws: If memory allocation throws.
Complexity: Amortized constant time.
iterator (const_iterator p, const T & x);
Requires: p must be a valid iterator of *this.
Effects: Insert a copy of x before p.
Returns: an iterator to the inserted element.
Throws: If memory allocation throws or x's copy constructor throws.
Complexity: If p is end(), amortized constant time Linear time otherwise.
iterator (const_iterator p, T && x);
Requires: p must be a valid iterator of *this.
Effects: Insert a new element before p with x's resources.
Returns: an iterator to the inserted element.
Throws: If memory allocation throws.
Complexity: If p is end(), amortized constant time Linear time otherwise.
iterator (const_iterator pos, size_type n, const value_type & x);
Requires: pos must be a valid iterator of *this.
Effects: Insert n copies of x before pos.
Returns: an iterator to the first inserted element or pos if n is 0.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
template<typename InIt> iterator (const_iterator pos, InIt first, InIt last);
Requires: pos must be a valid iterator of *this.
Effects: Insert a copy of the [first, last) range before pos.
Returns: an iterator to the first inserted element or pos if first == last.
Throws: If memory allocation throws, T's constructor from a dereferenced InIt throws or T's copy constructor throws.
Complexity: Linear to distance [first, last).
iterator (const_iterator pos, value_type > il);
Requires: pos must be a valid iterator of *this.
Effects: Insert a copy of the [il.begin(), il.end()) range before pos.
Returns: an iterator to the first inserted element or pos if il.begin() == il.end().
Throws: If memory allocation throws, T's constructor from a dereferenced std::initializer_list throws or T's copy constructor throws.
Complexity: Linear to distance [il.begin(), il.end()).
void () ;
Effects: Removes the first element from the deque.
Throws: Nothing.
Complexity: Constant time.
void () ;
Effects: Removes the last element from the deque.
Throws: Nothing.
Complexity: Constant time.
iterator (const_iterator pos) ;
Effects: Erases the element at p.
Throws: Nothing.
Complexity: Linear to the elements between pos and the last element (if pos is near the end) or the first element if(pos is near the beginning). Constant if pos is the first or the last element.
iterator (const_iterator first, const_iterator last) ;
Effects: Erases the elements pointed by [first, last).
Throws: Nothing.
Complexity: Linear to the distance between first and last plus the elements between pos and the last element (if pos is near the end) or the first element if(pos is near the beginning).
void (deque & x) ;
Effects: Swaps the contents of *this and x.
Throws: Nothing.
Complexity: Constant.
void () ;
Effects: Erases all the elements of the deque.
Throws: Nothing.
Complexity: Linear to the number of elements in the deque.
deque
friend functionsbool (const deque & x, const deque & y);
Effects: Returns true if x and y are equal
Complexity: Linear to the number of elements in the container.
bool (const deque & x, const deque & y);
Effects: Returns true if x and y are unequal
Complexity: Linear to the number of elements in the container.
bool (const deque & x, const deque & y);
Effects: Returns true if x is less than y
Complexity: Linear to the number of elements in the container.
bool (const deque & x, const deque & y);
Effects: Returns true if x is greater than y
Complexity: Linear to the number of elements in the container.
bool (const deque & x, const deque & y);
Effects: Returns true if x is equal or less than y
Complexity: Linear to the number of elements in the container.
bool (const deque & x, const deque & y);
Effects: Returns true if x is equal or greater than y
Complexity: Linear to the number of elements in the container.
void (deque & x, deque & y) ;
Effects: x.swap(y)
Complexity: Constant.