A container-like class similar to std::queue
that can store objects that do not have copy constructors.
More...
#include "nn/nlib/Nqueue.h"
|
size_t | size () const noexcept |
| Returns the number of stored elements.
|
|
size_t | capacity () const noexcept |
| Returns the number of allocated elements. More...
|
|
bool | empty () const noexcept |
| Returns true if the number of stored elements is 0, or returns false otherwise.
|
|
T * | push_back () noexcept |
| Adds an element to the end and initializes it with the default constructor. More...
|
|
T * | push_back (T &&rhs) noexcept |
| Moves a temporary object rhs and adds it to the end. More...
|
|
bool | pop_front () noexcept |
| Removes the first element from the front of the queue. More...
|
|
bool | push_back_swap (T *v) noexcept |
| Adds an element to the queue, and then swaps that element with v using std:: swap . More...
|
|
bool | pop_front_swap (T *v) noexcept |
| Uses std::swap to store the first element in v and then takes the first element from the queue. More...
|
|
|
constexpr | Nqueue () noexcept |
| Instantiates the object with default parameters (default constructor). Creates an empty queue.
|
|
| ~Nqueue () noexcept |
| Destructor.
|
|
| Nqueue (Nqueue &&rhs) noexcept |
| Instantiates the object (move constructor).
|
|
Nqueue & | operator= (Nqueue &&rhs) noexcept |
| Move assignment operator.
|
|
| Nqueue (Nqueue &rhs, move_tag) noexcept |
| Corresponds to a move constructor.
|
|
Nqueue & | assign (Nqueue &rhs, move_tag) noexcept |
| Corresponds to a move assignment operator.
|
|
template<class T, class AL = std::allocator<char>>
class nn::nlib::Nqueue< T, AL >
A container-like class similar to std::queue
that can store objects that do not have copy constructors.
- Template Parameters
-
T | Element type. |
AL | The allocator type. The default is std::allocator<char> . |
- Description
- Implemented internally using
Nlist<T>
.
Definition at line 30 of file Nqueue.h.
◆ capacity()
template<class T , class AL = std::allocator<char>>
Returns the number of allocated elements.
- Returns
- The number of elements.
Definition at line 69 of file Nqueue.h.
◆ pop_front()
template<class T , class AL = std::allocator<char>>
Removes the first element from the front of the queue.
- Returns
- Returns
true
if it succeeds, and false
if the queue is empty.
Definition at line 75 of file Nqueue.h.
◆ pop_front_swap()
template<class T , class AL >
Uses std::swap
to store the first element in v
and then takes the first element from the queue.
- Parameters
-
[out] | v | The pointer to where the first element in the queue is stored. |
- Returns
- Returns
true
if it succeeds, and false
if the queue is empty.
Definition at line 153 of file Nqueue.h.
◆ push_back() [1/2]
template<class T , class AL >
Adds an element to the end and initializes it with the default constructor.
- Returns
- Returns the pointer to the added element.
NULL
if process fails.
Definition at line 98 of file Nqueue.h.
◆ push_back() [2/2]
template<class T , class AL >
Moves a temporary object rhs and adds it to the end.
- Parameters
-
[in] | rhs | The element to be added to the end. |
- Returns
- Returns the pointer to the added element.
NULL
if process fails.
Definition at line 122 of file Nqueue.h.
◆ push_back_swap()
template<class T , class AL = std::allocator<char>>
Adds an element to the queue, and then swaps that element with v using std:: swap
.
- Parameters
-
[out] | v | The pointer to the element to add to the end of the queue. |
- Returns
- Returns
true
if successful. Returns false
on failure due to insufficient memory.
Definition at line 79 of file Nqueue.h.
The documentation for this class was generated from the following files: