Template Class stack

Class Documentation

template<class T, size_t N = 16>
class stack

A lightweight contiguous stack with SSO. This avoids a dependency on std.

Public Types

using iterator = T*
using const_iterator = T const*

Public Functions

inline stack(Callbacks const &cb)
inline stack()
inline ~stack()
inline stack(stack const &that) noexcept
inline stack(stack &&that) noexcept
inline stack &operator=(stack const &that) noexcept
inline stack &operator=(stack &&that) noexcept
inline size_t size() const
inline size_t empty() const
inline size_t capacity() const
inline void clear()
inline void resize(size_t sz)
void reserve(size_t sz)
inline void push (T const &C4_RESTRICT n)
inline void push_top()
inline T const  &C4_RESTRICT pop ()
inline C4_ALWAYS_INLINE T const  &C4_RESTRICT top () const
inline C4_ALWAYS_INLINE T &C4_RESTRICT top ()
inline C4_ALWAYS_INLINE T const  &C4_RESTRICT bottom () const
inline C4_ALWAYS_INLINE T &C4_RESTRICT bottom ()
inline C4_ALWAYS_INLINE T const  &C4_RESTRICT top (size_t i) const
inline C4_ALWAYS_INLINE T &C4_RESTRICT top (size_t i)
inline C4_ALWAYS_INLINE T const  &C4_RESTRICT bottom (size_t i) const
inline C4_ALWAYS_INLINE T &C4_RESTRICT bottom (size_t i)
inline C4_ALWAYS_INLINE T const  &C4_RESTRICT operator[] (size_t i) const
inline C4_ALWAYS_INLINE T &C4_RESTRICT operator[] (size_t i)
inline iterator begin()
inline iterator end()
inline const_iterator begin() const
inline const_iterator end() const
void _free()
void _cp (stack const *C4_RESTRICT that)
void _mv(stack *that)
void _cb(Callbacks const &cb)

Public Members

T m_buf[N]
T *m_stack
size_t m_size
size_t m_capacity
Callbacks m_callbacks

Public Static Functions

static inline constexpr bool is_contiguous()