16 #ifndef IOX_UTILS_CXX_STACK_HPP
17 #define IOX_UTILS_CXX_STACK_HPP
19 #include "iceoryx_utils/cxx/optional.hpp"
29 template <
typename T, u
int64_t Capacity>
41 template <
typename... Targs>
42 bool push(Targs&&... args) noexcept;
45 uint64_t
size()
const noexcept;
48 static constexpr uint64_t
capacity() noexcept;
51 using element_t = uint8_t[
sizeof(T)];
52 alignas(T) element_t m_data[Capacity];
58 #include "iceoryx_utils/internal/cxx/stack.inl"
Optional implementation from the C++17 standard with C++11. The interface is analog to the C++17 stan...
Definition: optional.hpp:63
stack implementation with a simple push pop interface
Definition: stack.hpp:31
uint64_t size() const noexcept
returns the stack size
Definition: stack.inl:48
static constexpr uint64_t capacity() noexcept
returns the stack capacity
Definition: stack.inl:54
bool push(Targs &&... args) noexcept
pushed an element into the stack by forwarding all arguments to the constructor of T
Definition: stack.inl:36
cxx::optional< T > pop() noexcept
returns the last pushed element when the stack contains elements otherwise a cxx::nullopt
Definition: stack.inl:24
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28