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. More...
|
|
size_t | capacity () const noexcept |
| Returns the number of allocated elements. More...
|
|
bool | empty () const noexcept |
| Checks whether the container is empty. More...
|
|
T * | push_back () noexcept |
| Adds an element to the end and initializes it with the default constructor. 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...
|
|
void | swap (Nqueue &rhs) noexcept |
| Swaps the container. 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). This function is useful when using C++11.
|
|
Nqueue & | operator= (Nqueue &&rhs) noexcept |
| Move assignment operator. This function is useful when using C++11.
|
|
| 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 65 of file Nqueue.h.
◆ empty()
template<class T , class AL = std::allocator<char>>
Checks whether the container is empty.
- Returns
- Returns
true
if empty.
Definition at line 66 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 71 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 157 of file Nqueue.h.
◆ push_back()
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. Returns
NULL
on failure due to insufficient memory.
Definition at line 102 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 75 of file Nqueue.h.
◆ size()
template<class T , class AL = std::allocator<char>>
Returns the number of stored elements.
- Returns
- The number of elements.
Definition at line 64 of file Nqueue.h.
◆ swap()
template<class T , class AL = std::allocator<char>>
Swaps the container.
- Deprecated:
- This function will be deleted in a future release.
Definition at line 83 of file Nqueue.h.
The documentation for this class was generated from the following files: