C++ Channel
Loading...
Searching...
No Matches
Public Member Functions | List of all members
msd::queue_storage< T > Class Template Reference

A FIFO queue storage using std::queue. More...

#include <storage.hpp>

Public Member Functions

 queue_storage (std::size_t)
 Constructs the queue storage (parameter ignored, required for interface compatibility).
 
template<typename Type >
void push_back (Type &&value)
 Adds an element to the back of the queue.
 
void pop_front (T &out)
 Removes the front element from the queue and moves it to the output.
 
NODISCARD std::size_t size () const noexcept
 Returns the number of elements currently stored.
 

Detailed Description

template<typename T>
class msd::queue_storage< T >

A FIFO queue storage using std::queue.

Template Parameters
TType of elements stored.

Constructor & Destructor Documentation

◆ queue_storage()

template<typename T >
msd::queue_storage< T >::queue_storage ( std::size_t  )
inlineexplicit

Constructs the queue storage (parameter ignored, required for interface compatibility).

Warning
Do not construct manually. This constructor may change anytime.

Member Function Documentation

◆ pop_front()

template<typename T >
void msd::queue_storage< T >::pop_front ( T out)
inline

Removes the front element from the queue and moves it to the output.

Parameters
outReference to the variable where the front element will be moved.
Warning
It's undefined behaviour to pop from an empty queue.

◆ push_back()

template<typename T >
template<typename Type >
void msd::queue_storage< T >::push_back ( Type &&  value)
inline

Adds an element to the back of the queue.

Template Parameters
TypeType of the element to insert.
Parameters
valueThe value to insert (perfect forwarded).

◆ size()

template<typename T >
NODISCARD std::size_t msd::queue_storage< T >::size ( ) const
inlinenoexcept

Returns the number of elements currently stored.

Returns
Current size.

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