nlib
nn::nlib::ReallocQueue< T > Class Template Reference

The class for realloc-based implementations of queues with POD-type elements. More...

#include "nn/nlib/ReallocVec.h"

Public Types

typedef ReallocVec< T >::ReallocFunc ReallocFunc
 The type for functions corresponding to realloc.
 

Public Member Functions

 ReallocQueue () noexcept
 Uses std::realloc with the default constructor.
 
 ReallocQueue (ReallocFunc func) noexcept
 Enables the user to specify the realloc function with the constructor. More...
 
void swap (ReallocQueue &rhs) noexcept
 Swaps queues. More...
 
ReallocFunc GetRealloc () const noexcept
 Gets the specified realloc function. More...
 
size_t size () const noexcept
 Gets the size of the queue. More...
 
bool empty () const noexcept
 Determines whether the queue is empty. More...
 
bool push (const T &val) noexcept
 Adds an element to the queue. More...
 
bool pop () noexcept
 Deletes the first element in the queue. More...
 
T & front ()
 Gets the first element in the queue. More...
 
bool pop (T *v) noexcept
 Gets the first element in the queue and then deletes it. More...
 

Detailed Description

template<class T>
class nn::nlib::ReallocQueue< T >

The class for realloc-based implementations of queues with POD-type elements.

Template Parameters
TThe element type. This type must be POD.
Description
T must be aligned to an alignment guaranteed by realloc.

Definition at line 199 of file ReallocVec.h.

Constructor & Destructor Documentation

◆ ReallocQueue()

template<class T >
nn::nlib::ReallocQueue< T >::ReallocQueue ( ReallocFunc  func)
inlineexplicitnoexcept

Enables the user to specify the realloc function with the constructor.

Parameters
[in]funcThe realloc function.

Definition at line 203 of file ReallocVec.h.

Member Function Documentation

◆ empty()

template<class T >
nn::nlib::ReallocQueue< T >::empty ( ) const
inlinenoexcept

Determines whether the queue is empty.

Returns
Returns true if empty.

Definition at line 245 of file ReallocVec.h.

◆ front()

template<class T >
nn::nlib::ReallocQueue< T >::front ( )
inline

Gets the first element in the queue.

Returns
The reference to the first element in the queue.

Definition at line 260 of file ReallocVec.h.

◆ GetRealloc()

template<class T >
nn::nlib::ReallocQueue< T >::GetRealloc ( ) const
inlinenoexcept

Gets the specified realloc function.

Returns
The realloc function.

Definition at line 239 of file ReallocVec.h.

◆ pop() [1/2]

template<class T >
nn::nlib::ReallocQueue< T >::pop ( )
inlinenoexcept

Deletes the first element in the queue.

Returns
Returns true when successful.

Definition at line 249 of file ReallocVec.h.

◆ pop() [2/2]

template<class T >
nn::nlib::ReallocQueue< T >::pop ( T *  v)
inlinenoexcept

Gets the first element in the queue and then deletes it.

Parameters
[in]vThe pointer to where the first element in the queue is stored.
Returns
Returns true when successful.

Definition at line 270 of file ReallocVec.h.

◆ push()

template<class T >
nn::nlib::ReallocQueue< T >::push ( const T &  val)
inlinenoexcept

Adds an element to the queue.

Parameters
[in]valThe element to add.
Returns
Returns true when successful.

Definition at line 248 of file ReallocVec.h.

◆ size()

template<class T >
nn::nlib::ReallocQueue< T >::size ( ) const
inlinenoexcept

Gets the size of the queue.

Returns
The size of the queue.

Definition at line 242 of file ReallocVec.h.

◆ swap()

template<class T >
nn::nlib::ReallocQueue< T >::swap ( ReallocQueue< T > &  rhs)
inlinenoexcept

Swaps queues.

Parameters
[in]rhsThe queue to swap.
Deprecated:
This function will be deleted in a future release.

Definition at line 233 of file ReallocVec.h.


The documentation for this class was generated from the following files: