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...
 
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...
 
void swap (ReallocQueue &rhs) noexcept
 Swaps queues. 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 164 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 168 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 179 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 193 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 173 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 183 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 202 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 182 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 176 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.

Definition at line 213 of file ReallocVec.h.


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