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
Const reference to T
.
Definition at line 251 of file circular_queue.hpp.
◆ pointer
Pointer to T
.
Definition at line 248 of file circular_queue.hpp.
◆ reference
Reference to T
.
Definition at line 250 of file circular_queue.hpp.
◆ size_type
Equivalent to std::size_t.
Definition at line 252 of file circular_queue.hpp.
◆ value_type
The type of object, T
, stored in the queue.
Definition at line 247 of file circular_queue.hpp.
Constructor & Destructor Documentation
◆ circular_queue()
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
◆ capacity()
adobe::circular_queue::size_type capacity | ( | ) | const |
- Returns
Capacity
.
Definition at line 264 of file circular_queue.hpp.
◆ clear()
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.
◆ empty()
bool empty | ( | ) | const |
- Returns
true
if the queue's size is 0.
Definition at line 266 of file circular_queue.hpp.
◆ front() [1/2]
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.
◆ front() [2/2]
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.
◆ full()
bool full | ( | ) | const |
- Returns
true
ifsize() == capacity()
.
Definition at line 267 of file circular_queue.hpp.
◆ max_size()
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.
◆ pop_front()
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.
◆ push_back()
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.
◆ putback()
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()
.
Definition at line 399 of file circular_queue.hpp.
◆ size()
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
◆ operator==()
|
related |
- Parameters
-
x first queue to compare y second queue to compare
- Complexity Guarantees:
- Linear.
size()
elements are compared (popped elements are not compared).
◆ swap()
|
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.