PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::GrowableStack< T, N > Class Template Reference

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. More...

#include <GrowableStack.hpp>

Collaboration diagram for playrho::GrowableStack< T, N >:
[legend]

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Private Attributes

ElementType m_array [N]
 Array data.
 
ElementTypem_stack = m_array
 Pointer to array of data.
 
CountType m_count = 0
 Count of elements.
 
CountType m_capacity = N
 Capacity for storing elements.
 

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.

Member Function Documentation

◆ 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.

Referenced by playrho::d2::Query(), and playrho::d2::RayCast().


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