circular_queue< T > Class Template Reference
Detailed Descriptiontemplate<typename T>
|
typedef const T* const_pointer |
Definition at line 249 of file circular_queue.hpp.
Const reference to T
.
Definition at line 251 of file circular_queue.hpp.
Pointer to T
.
Definition at line 248 of file circular_queue.hpp.
Reference to T
.
Definition at line 250 of file circular_queue.hpp.
Equivalent to std::size_t.
Definition at line 252 of file circular_queue.hpp.
The type of object, T
, stored in the queue.
Definition at line 247 of file circular_queue.hpp.
Constructor & Destructor Documentation
circular_queue | ( | std::size_t | capacity = 0 | ) |
Creates a circular_queue.
- Parameters:
-
capacity Capacity for this queue.
Definition at line 320 of file circular_queue.hpp.
Member Function Documentation
adobe::circular_queue::size_type capacity | ( | ) | const |
- Returns:
Capacity
.
Definition at line 264 of file circular_queue.hpp.
void clear | ( | ) |
All elements are removed from the queue. Equivalent to while (size()) pop_front();
except with constant complexity.
Definition at line 269 of file circular_queue.hpp.
bool empty | ( | ) | const |
- Returns:
true
if the queue's size is 0.
Definition at line 266 of file circular_queue.hpp.
circular_queue< T >::reference front | ( | ) |
- Returns:
- A mutable reference to the element at the front of the queue, that is, the element least recently inserted.
- Precondition:
empty()
isfalse
.
Definition at line 354 of file circular_queue.hpp.
circular_queue< T >::const_reference front | ( | ) | const |
- Returns:
- A const reference to the element at the front of the queue, that is, the element least recently inserted.
- Precondition:
empty()
isfalse
.
Definition at line 363 of file circular_queue.hpp.
bool full | ( | ) | const |
- Returns:
true
ifsize() == capacity()
.
Definition at line 267 of file circular_queue.hpp.
adobe::circular_queue::size_type max_size | ( | ) | const |
Equivalent to capacity()
, provided for completeness.
- Returns:
Capacity
Definition at line 263 of file circular_queue.hpp.
void pop_front | ( | ) |
The element at the front of the queue is removed. The element is not destructed and may be returned with putback()
.
- Precondition:
empty()
isfalse
.
- Postcondition:
size()
will be decremented by1
.
Definition at line 388 of file circular_queue.hpp.
void push_back | ( | T | x | ) |
- Parameters:
-
x Inserts x
at the back of the queue.
- Postcondition:
- If
full()
, the front item of the queue will be lost and the queue will remain full. Otherwise,size()
will be incremented by1
.
Definition at line 373 of file circular_queue.hpp.
void putback | ( | ) |
The last element popped from the front of the queue is returned to the front of the queue.
- Precondition:
- Result undefined if putback() is called more times than pop_front().
-
Result is undefined if
full()
.
circular_queue<int> queue; queue.push_back(10); queue.push_back(20); assert(queue.front() == 10); queue.pop_front(); assert(queue.front() == 20); queue.putback(); assert(queue.front() == 10);
Definition at line 399 of file circular_queue.hpp.
circular_queue< T >::size_type size | ( | ) | const |
- Returns:
- The number of elements retained in the queue.
Definition at line 411 of file circular_queue.hpp.
Friends And Related Function Documentation
bool operator== | ( | const circular_queue< T > & | x, |
const circular_queue< T > & | y | ||
) | [related] |
- Parameters:
-
x first queue to compare y second queue to compare
- Complexity Guarantees:
- Linear.
size()
elements are compared (popped elements are not compared).
bool swap | ( | circular_queue< T > & | x, |
circular_queue< T > & | y | ||
) | [related] |
- Parameters:
-
x first queue to swap y second queue to swap
- Exceptions:
-
Unknown If the elements are swappable without throwing then the circular_queue will be swappable without throwing. See the requirements for Assignable.
- Complexity Guarantees:
- Linear.
size()
of larger queue elements are swapped.