|
libhatchet
|
#include <hxdeque.hpp>
Public Member Functions | |
| hxdeque (hxsize_t dynamic_capacity_=0) | |
| ~hxdeque (void) | |
| T & | operator[] (hxsize_t index_) |
| const T & | operator[] (hxsize_t index_) const |
| T & | at (hxsize_t index_) |
| const T & | at (hxsize_t index_) const |
| T & | back (void) |
| const T & | back (void) const |
| hxsize_t | capacity (void) const |
| void | clear (void) noexcept |
| template<typename... args_t_> | |
| void | emplace_back (args_t_ &&... args_) noexcept |
| template<typename... args_t_> | |
| void | emplace_front (args_t_ &&... args_) noexcept |
| bool | empty (void) const |
| T & | front (void) |
| const T & | front (void) const |
| bool | full (void) const |
| hxsize_t | max_size (void) const |
| void | pop_back (void) noexcept |
| void | pop_front (void) noexcept |
| template<typename... args_t_> | |
| void | push_back (args_t_ &&... args_) noexcept |
| template<typename... args_t_> | |
| void | push_front (args_t_ &&... args_) noexcept |
| void | reserve (hxsize_t dynamic_capacity_) |
| hxsize_t | size (void) const |
hxdeque - A fixed-capacity deque backed by a power-of-two ring buffer.
All operations are Θ(1). The capacity must be a power of two and greater than zero. This is designed to do one thing very well and that is all.
|
explicit |
Constructs an empty hxdeque.
When using static storage the capacity is fixed at compile time.
| hxdeque< T, capacity_ >::~hxdeque | ( | void | ) |
Destroys all elements in the deque.
| T & hxdeque< T, capacity_ >::at | ( | hxsize_t | index_ | ) |
Returns a reference to the element at logical index index.
| const T & hxdeque< T, capacity_ >::at | ( | hxsize_t | index_ | ) | const |
Returns a const reference to the element at logical index index.
| T & hxdeque< T, capacity_ >::back | ( | void | ) |
Returns a reference to the back element.
| const T & hxdeque< T, capacity_ >::back | ( | void | ) | const |
Returns a const reference to the back element.
| hxsize_t hxdeque< T, capacity_ >::capacity | ( | void | ) | const |
Returns the capacity of the deque or 0 if unallocated.
|
noexcept |
Destroys all elements and resets the deque to empty without deallocating.
|
noexcept |
Constructs an element in place at the back using forwarded arguments.
Exactly the same as push_back.
|
noexcept |
Constructs an element in place at the front using forwarded arguments.
Exactly the same as push_front.
| bool hxdeque< T, capacity_ >::empty | ( | void | ) | const |
Returns true if the deque contains no elements.
| T & hxdeque< T, capacity_ >::front | ( | void | ) |
Returns a reference to the front element.
| const T & hxdeque< T, capacity_ >::front | ( | void | ) | const |
Returns a const reference to the front element.
| bool hxdeque< T, capacity_ >::full | ( | void | ) | const |
Returns true if the deque is at capacity.
|
inline |
Returns the capacity of the deque.
| T & hxdeque< T, capacity_ >::operator[] | ( | hxsize_t | index_ | ) |
Returns a reference to the element at logical index index.
| const T & hxdeque< T, capacity_ >::operator[] | ( | hxsize_t | index_ | ) | const |
Returns a const reference to the element at logical index index.
|
noexcept |
Removes and destroys the back element.
|
noexcept |
Removes and destroys the front element.
|
noexcept |
Appends an element at the back using forwarded arguments.
Exactly the same as emplace_back.
|
noexcept |
Prepends an element at the front using forwarded arguments.
Exactly the same as emplace_front.
| void hxdeque< T, capacity_ >::reserve | ( | hxsize_t | dynamic_capacity_ | ) |
Allocates storage for a dynamic deque.
May only be called once and only when the deque has no storage.
| hxsize_t hxdeque< T, capacity_ >::size | ( | void | ) | const |
Returns the number of elements currently in the deque.