Skip to content

iox::cxx::stack🔗

stack implementation with a simple push pop interface More...

#include <stack.hpp>

Public Functions🔗

Name
cxx::optional< T > pop()
returns the last pushed element when the stack contains elements otherwise a cxx::nullopt
template \<typename... Targs>
bool
push(Targs &&... args)
pushed an element into the stack by forwarding all arguments to the constructor of T
uint64_t size() const
returns the stack size
constexpr uint64_t capacity()
returns the stack capacity

Detailed Description🔗

template <typename T ,
uint64_t Capacity>
class iox::cxx::stack;

stack implementation with a simple push pop interface

Template Parameters:

  • T type which the stack contains
  • Capacity the capacity of the stack

Public Functions Documentation🔗

function pop🔗

inline cxx::optional< T > pop()

returns the last pushed element when the stack contains elements otherwise a cxx::nullopt

function push🔗

template <typename... Targs>
inline bool push(
    Targs &&... args
)

pushed an element into the stack by forwarding all arguments to the constructor of T

Parameters:

  • args arguments which will be perfectly forwarded to the constructor of T

Return: true if the push was successful, otherwise false

function size🔗

inline uint64_t size() const

returns the stack size

function capacity🔗

static inline constexpr uint64_t capacity()

returns the stack capacity


Updated on 17 June 2021 at 11:15:26 CEST