This class template provides an STL‐compliant deque that conforms to the bslma::Allocator model. For the requirements of a deque class, consult the C++11 standard. In particular, this implementation offers the general rules that: 1. A call to any method that would result in a deque having a size greater than the value returned by max_size triggers a call to bslstl::StdExceptUtil::throwLengthError. 2. A call to an at method that attempts to access a position outside of the valid range of a deque triggers a call to bslstl::StdExceptUtil::throwOutOfRange.
Synopsis
Declared in <bslstl_deque.h>
template<
class VALUE_TYPE,
class ALLOCATOR = allocator<VALUE_TYPE>>
class deque
: public Deque_Base<VALUE_TYPE>
Description
Note that portions of the standard methods are implemented in Deque_Base, which is parameterized on only VALUE_TYPE in order to generate smaller debug strings.
This class: * supports a complete set of value‐semantic operations
-
except for
BDEXserialization * is exception‐neutral * is alias‐safe * isconstthread‐safe For terminology see {`bsldoc_glossary`}.
In addition, the following members offer a full guarantee of rollback: if an exception is thrown during the invocation of insert, push_front, or push_back on a pre‐existing object, the object is left in a valid state and its value is unchanged.
Base Classes
Name |
Description |
This class describes the basic layout for a deque class. It is important that this class has the same layout as the deque class implementation. It is parameterized by |
Type Aliases
Name |
Description |
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this object. |
Assignment operators |
|
Append to the end of this object the elements of the specified |
|
|
|
Assign to this object the elements of the specified |
|
|
|
|
|
|
|
Return the sum of the current size of this deque plus the minimum number of |
|
Return an iterator providing non‐modifiable access to the first element in this deque, and the past‐the‐end iterator if this deque is empty. |
|
Return the past‐the‐end (forward) iterator providing non‐modifiable access to this deque. |
|
Remove all elements from this deque making its size 0. Note that although this deque is empty after this method returns, it preserves the same capacity it had before the method was called. |
|
Return a reverse iterator providing non‐modifiable access to the last element in this deque, and the past‐the‐end reverse iterator if this deque is empty. |
|
Return the past‐the‐end reverse iterator providing non‐modifiable access to this deque. |
|
Insert at the specified |
|
Append to the back of this deque a newly created |
|
Prepend to the front of this deque a newly created |
|
Return |
|
|
|
|
|
|
|
Return the allocator used by this deque to supply memory. |
|
|
|
Insert at the specified |
|
Return the maximum possible size of this deque. Note that this is a theoretical maximum (such as the maximum value that can be held by |
|
Subscript operators |
|
Erase the last element from this deque. The behavior is undefined if this deque is empty. |
|
Erase the first element from this deque. The behavior is undefined if this deque is empty. |
|
Prepend to the front of this object the elements of the specified |
|
|
|
|
|
|
|
|
|
Change the capacity of this deque such that, after this method returns, iterators remain valid provided that no more than the specified |
|
|
|
Minimize the memory used by this deque to the extent possible without moving any contained elements. If an exception is thrown, the value of this object is unchanged. Note that this method has no effect on the memory used by individual elements of the (template parameter) |
|
Return the number of elements contained by this deque. |
|
Exchange the value of this object with that of the specified |
Protected Data Members
Name |
Description |
Length of the |
|
Array of pointers to blocks (owned). |
|
The |
|
The |
Deduction Guides
Name |
Description |
Deduce the template parameter |
|
Deduce the template parameter |
|
Deduce the template parameter |
|
Deduce the template parameter |
|
Deduce the template parameter |
|
|
Deduce the template parameters |
Friends
Name |
Description |
This class provides a proctor that maintains a count of the number of elements constructed at the front or back of a deque, but not yet committed to the deque's range of valid elements; if the count is non‐zero at destruction, the destructor destroys the elements in the range |
|
This class implements a proctor that, upon destruction and unless its |
|
This class allocates blocks at the front or back of a deque and tentatively adds them to the deque. It also keeps track of how many of the newly allocated blocks have actually been used by the deque. The destructor automatically frees any unused blocks (e.g., in case an exception is thrown). |
Non-Member Functions
Name |
Description |
Erase all the elements in the specified deque |
|
Erase all the elements in the specified deque |
|
Perform a lexicographic three‐way comparison of the specified |
|
Return |
|
Exchange the value of the specified |
Created with MrDocs