numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::util::static_stack< T, StaticArraySize > Class Template Reference

Class of stacks using static arrays. More...

#include <num_collect/util/static_stack.h>

+ Collaboration diagram for num_collect::util::static_stack< T, StaticArraySize >:

Public Member Functions

 static_stack ()
 Constructor.
 
 static_stack (const static_stack &)=delete
 
 static_stack (static_stack &&)=delete
 
 ~static_stack ()
 Destructor.
 
auto empty () const noexcept -> bool
 Check whether this stack is empty.
 
auto operator= (const static_stack &) -> static_stack &=delete
 
auto operator= (static_stack &&) -> static_stack &=delete
 
void pop () noexcept
 Pop a value.
 
void push (const T &value)
 Push a value.
 
auto size () const noexcept -> std::size_t
 Get the current number of values.
 
auto top () const noexcept -> const T &
 Get the top value.
 
auto top () noexcept -> T &
 Get the top value.
 

Private Attributes

T * begin_
 Pointer to the first element in the buffer.
 
char buffer_ [sizeof(T[StaticArraySize])] {}
 Buffer for stack.
 
T * end_
 Pointer to the past-the-end element in the buffer.
 
T * storage_end_
 Pointer to the past-the-end storage in the buffer.
 

Detailed Description

template<typename T, std::size_t StaticArraySize>
class num_collect::util::static_stack< T, StaticArraySize >

Class of stacks using static arrays.

Template Parameters
TType of values in the stack.
StaticArraySizeSize of the static array for the stack.

Definition at line 40 of file static_stack.h.

Constructor & Destructor Documentation

◆ static_stack()

template<typename T , std::size_t StaticArraySize>
num_collect::util::static_stack< T, StaticArraySize >::static_stack ( )
inline

Constructor.

Definition at line 45 of file static_stack.h.

◆ ~static_stack()

template<typename T , std::size_t StaticArraySize>
num_collect::util::static_stack< T, StaticArraySize >::~static_stack ( )
inline

Destructor.

Definition at line 59 of file static_stack.h.

Member Function Documentation

◆ empty()

template<typename T , std::size_t StaticArraySize>
auto num_collect::util::static_stack< T, StaticArraySize >::empty ( ) const -> bool
inlinenodiscardnoexcept

Check whether this stack is empty.

Return values
trueThis stack is empty.
falseThis stack is not empty.

Definition at line 104 of file static_stack.h.

◆ pop()

template<typename T , std::size_t StaticArraySize>
void num_collect::util::static_stack< T, StaticArraySize >::pop ( )
inlinenoexcept

Pop a value.

Definition at line 79 of file static_stack.h.

◆ push()

template<typename T , std::size_t StaticArraySize>
void num_collect::util::static_stack< T, StaticArraySize >::push ( const T & value)
inline

Push a value.

Parameters
[in]valueValue.

Definition at line 70 of file static_stack.h.

◆ size()

template<typename T , std::size_t StaticArraySize>
auto num_collect::util::static_stack< T, StaticArraySize >::size ( ) const -> std::size_t
inlinenodiscardnoexcept

Get the current number of values.

Returns
Current number of values.

Definition at line 111 of file static_stack.h.

◆ top() [1/2]

template<typename T , std::size_t StaticArraySize>
auto num_collect::util::static_stack< T, StaticArraySize >::top ( ) const -> const T&
inlinenodiscardnoexcept

Get the top value.

Returns
Value.

Definition at line 89 of file static_stack.h.

◆ top() [2/2]

template<typename T , std::size_t StaticArraySize>
auto num_collect::util::static_stack< T, StaticArraySize >::top ( ) -> T&
inlinenodiscardnoexcept

Get the top value.

Returns
Value.

Definition at line 96 of file static_stack.h.

Member Data Documentation

◆ begin_

template<typename T , std::size_t StaticArraySize>
T* num_collect::util::static_stack< T, StaticArraySize >::begin_
private

Pointer to the first element in the buffer.

Definition at line 120 of file static_stack.h.

◆ buffer_

template<typename T , std::size_t StaticArraySize>
char num_collect::util::static_stack< T, StaticArraySize >::buffer_[sizeof(T[StaticArraySize])] {}
private

Buffer for stack.

Definition at line 117 of file static_stack.h.

◆ end_

template<typename T , std::size_t StaticArraySize>
T* num_collect::util::static_stack< T, StaticArraySize >::end_
private

Pointer to the past-the-end element in the buffer.

Definition at line 123 of file static_stack.h.

◆ storage_end_

template<typename T , std::size_t StaticArraySize>
T* num_collect::util::static_stack< T, StaticArraySize >::storage_end_
private

Pointer to the past-the-end storage in the buffer.

Definition at line 126 of file static_stack.h.


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