Template Class stack
Defined in File stack.hpp
Class Documentation
-
template<typename T, uint64_t Capacity>
class 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
-
cxx::optional<T> pop() noexcept
returns the last pushed element when the stack contains elements otherwise a cxx::nullopt
-
template<typename ...Targs>
bool push(Targs&&... args) noexcept pushed an element into the stack by forwarding all arguments to the constructor of T
- Parameters:
args – [in] arguments which will be perfectly forwarded to the constructor of T
- Returns:
true if the push was successful, otherwise false
-
uint64_t size() const noexcept
returns the stack size
Public Static Functions
-
static constexpr uint64_t capacity() noexcept
returns the stack capacity