playrho::GrowableStack< T, N > Class Template Reference

#include <GrowableStack.hpp>

Public Types

using ElementType = T
 Element type. More...
 
using CountType = std::size_t
 Count type. More...
 

Public Member Functions

 GrowableStack ()=default
 
 GrowableStack (const GrowableStack &other)=delete
 
 GrowableStack (GrowableStack &&other)=delete
 
 ~GrowableStack () noexcept
 
GrowableStackoperator= (const GrowableStack &copy)=delete
 
GrowableStackoperator= (GrowableStack &&copy)=delete
 
void push (const ElementType &element)
 Pushes the given elements onto this stack. More...
 
ElementType top () const
 Accesses the "top" element. More...
 
void pop () noexcept
 Pops the "top" element. More...
 
PLAYRHO_CONSTEXPR CountType size () const noexcept
 Gets the current size in numbers of elements. More...
 
PLAYRHO_CONSTEXPR CountType capacity () const noexcept
 Gets the capacity in number of elements. More...
 
PLAYRHO_CONSTEXPR bool empty () const noexcept
 Whether this stack is empty. More...
 

Static Public Member Functions

static PLAYRHO_CONSTEXPR CountType GetInitialCapacity () noexcept
 Gets the initial capacity. More...
 
static PLAYRHO_CONSTEXPR CountType GetBufferGrowthRate () noexcept
 Gets the buffer growth rate. More...
 

Detailed Description

template<typename T, std::size_t N>
class playrho::GrowableStack< T, N >

This is a growable LIFO stack with an initial capacity of N. If the stack size exceeds the initial capacity, the heap is used to increase the size of the stack.

Definition at line 34 of file GrowableStack.hpp.

Member Typedef Documentation

◆ ElementType

template<typename T , std::size_t N>
using playrho::GrowableStack< T, N >::ElementType = T

Element type.

Definition at line 39 of file GrowableStack.hpp.

◆ CountType

template<typename T , std::size_t N>
using playrho::GrowableStack< T, N >::CountType = std::size_t

Count type.

Definition at line 42 of file GrowableStack.hpp.

Constructor & Destructor Documentation

◆ GrowableStack() [1/3]

template<typename T , std::size_t N>
playrho::GrowableStack< T, N >::GrowableStack ( )
default

◆ GrowableStack() [2/3]

template<typename T , std::size_t N>
playrho::GrowableStack< T, N >::GrowableStack ( const GrowableStack< T, N > &  other)
delete

◆ GrowableStack() [3/3]

template<typename T , std::size_t N>
playrho::GrowableStack< T, N >::GrowableStack ( GrowableStack< T, N > &&  other)
delete

◆ ~GrowableStack()

template<typename T , std::size_t N>
playrho::GrowableStack< T, N >::~GrowableStack ( )
inlinenoexcept

Definition at line 62 of file GrowableStack.hpp.

Member Function Documentation

◆ GetInitialCapacity()

template<typename T , std::size_t N>
static PLAYRHO_CONSTEXPR CountType playrho::GrowableStack< T, N >::GetInitialCapacity ( )
inlinestaticnoexcept

Gets the initial capacity.

Definition at line 45 of file GrowableStack.hpp.

◆ GetBufferGrowthRate()

template<typename T , std::size_t N>
static PLAYRHO_CONSTEXPR CountType playrho::GrowableStack< T, N >::GetBufferGrowthRate ( )
inlinestaticnoexcept

Gets the buffer growth rate.

Definition at line 51 of file GrowableStack.hpp.

◆ operator=() [1/2]

template<typename T , std::size_t N>
GrowableStack& playrho::GrowableStack< T, N >::operator= ( const GrowableStack< T, N > &  copy)
delete

◆ operator=() [2/2]

template<typename T , std::size_t N>
GrowableStack& playrho::GrowableStack< T, N >::operator= ( GrowableStack< T, N > &&  copy)
delete

◆ push()

template<typename T , std::size_t N>
void playrho::GrowableStack< T, N >::push ( const ElementType element)
inline

Pushes the given elements onto this stack.

Definition at line 76 of file GrowableStack.hpp.

◆ top()

template<typename T , std::size_t N>
ElementType playrho::GrowableStack< T, N >::top ( ) const
inline

Accesses the "top" element.

Warning
Behavior is undefined if this stack doesn't already have at least one value pushed onto it.

Definition at line 97 of file GrowableStack.hpp.

◆ pop()

template<typename T , std::size_t N>
void playrho::GrowableStack< T, N >::pop ( )
inlinenoexcept

Pops the "top" element.

Definition at line 104 of file GrowableStack.hpp.

◆ size()

template<typename T , std::size_t N>
PLAYRHO_CONSTEXPR CountType playrho::GrowableStack< T, N >::size ( ) const
inlinenoexcept

Gets the current size in numbers of elements.

Definition at line 111 of file GrowableStack.hpp.

◆ capacity()

template<typename T , std::size_t N>
PLAYRHO_CONSTEXPR CountType playrho::GrowableStack< T, N >::capacity ( ) const
inlinenoexcept

Gets the capacity in number of elements.

Definition at line 117 of file GrowableStack.hpp.

◆ empty()

template<typename T , std::size_t N>
PLAYRHO_CONSTEXPR bool playrho::GrowableStack< T, N >::empty ( ) const
inlinenoexcept

Whether this stack is empty.

Definition at line 123 of file GrowableStack.hpp.


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