87 template<
class T, u32 stack_size>
91 std::is_trivially_destructible_v<T>,
92 "FixedStack only supports trivially destructible types to avoid resource leaks.");
93 static_assert(
stack_size > 0,
"FixedStack must have a size greater than 0.");
121 inline void push(
const T &val) {
137 inline constexpr const T &
top()
const {
143 inline constexpr void pop() {
std::uint32_t u32
32 bit unsigned integer
Shamrock assertion utility.
#define SHAM_ASSERT(x)
Shorthand for SHAM_ASSERT_NAMED without a message.
namespace for basic c++ utilities
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Fixed-capacity stack container with compile-time size determination.
constexpr u32 size() const
Returns the number of elements in the stack.
T & top()
Access the top element.
constexpr void pop()
Remove the top element from the stack.
constexpr bool empty() const
Check if the stack is empty.
u32 stack_cursor
Cursor pointing to the next available slot (stack_size = empty, 0 = full)
void push(const T &val)
Push an element onto the top of the stack.
T pop_ret()
Remove and return the top element from the stack.
constexpr const T & top() const
Access the top element (const version)
constexpr FixedStack()
Default constructor creating an empty stack.
constexpr FixedStack(const T &val)
Constructor creating a stack with one initial element.
T id_stack[stack_size]
Storage array for stack elements.
constexpr bool is_not_empty() const
Check if the stack contains any elements.