This class implements an efficient, in‐place double‐ended queue of values of parameterized type T. The physical capacity of this queue may grow, but never shrinks. Capacity may be reserved initially via a constructor, or at any time thereafter by using the reserveCapacity and reserveCapacityRaw methods. Note that there is no guarantee of contiguous storage of consecutive elements.
Synopsis
Declared in <bdlc_queue.h>
template<class T>
class Queue;
Description
More generally, this container class supports a complete set of *value semantics* operations, including copy construction, assignment, equality comparison, ostream printing, and bdex serialization. (A precise operational definition of when two objects have the same value can be found in the description of operator== for the class.) This container is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre‐existing object, the container is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.
Types
Name |
Description |
Enable uniform use of an optional integral constructor argument to specify the initial internal capacity (in elements). For example, ` Queue<unsigned int> x(Queue::InitialCapacity(8)); ` instantiates an object |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this object. |
Assign to this queue the value of the specified |
|
|
|
|
|
Assign to this object the value read from the specified input |
|
Write the value of this object, using the specified |
|
|
|
|
|
Return the number of elements in this queue. |
|
Subscript operators |
|
Remove the value from the back of this queue efficiently (in O[1] time). The behavior is undefined if this queue is empty. Note that this function is logically equivalent to (but more efficient than): ` remove(length() ‐ 1) ` |
|
Remove the value from the front of this queue efficiently (in O[1] time). The behavior is undefined if this queue is empty. Note that this function is logically equivalent to (but more efficient than): ` remove(0) ` |
|
Format this object to the specified output |
|
Append the specified |
|
Insert the specified |
|
|
|
Remove all elements from this queue. If the optionally specified |
|
|
|
Reserve sufficient internal capacity to accommodate up to the specified |
|
Reserve sufficient and minimal internal capacity to accommodate up to the specified |
|
|
|
Set the length of this queue to the specified |
|
Write the elements of this queue out to the specified |
|
Swap efficiently the values at the specified indices |
|
|
Declare that this type has a |
|
Declare that this type uses a |
Static Member Functions
Name |
Description |
|
|
Return the most current |
Non-Member Functions
Name |
Description |
Return |
|
Return |
Created with MrDocs