omni::graph::exec::unstable::detail::SmallStack
Defined in omni/graph/exec/unstable/SmallStack.h
-
template<typename T = uint64_t>
class SmallStack ABI-aware stack with inline memory to avoid heap allocation.
Reserved memory within the stack will be used until it is exceeded, at which heap memory will be used.
It is assumed the items stored are
sizeof(uint64_t)
.This class can safely be passed by pointer across the ABI. However, since it is not a trivial type, it cannot be passed by value across the ABI. See OMNI_STATIC_ASSERT_CAN_BE_PASSED_BY_VALUE_IN_ABI for details.
Public Functions
-
inline SmallStack() noexcept
Constructor.
-
inline SmallStack(const SmallStack &other) noexcept
Copy constructor.
-
inline SmallStack(ItemType *begin, ItemType *end) noexcept
Construct from a range.
end
must be equal or greater thanbegin
.
-
inline SmallStack(const SmallStack &other, ItemType item) noexcept
Copies the contents of the given stack and pushes the given item.
-
inline SmallStack(SmallStack &&other) noexcept
Move constructor.
-
inline ~SmallStack() noexcept
Destructor.
-
inline SmallStack &operator=(const SmallStack &other) noexcept
Assignment operator.
-
inline SmallStack &operator=(SmallStack &&other) noexcept
Assignment operator.
-
inline int compare(const SmallStack &other) const noexcept
Compares two stacks, returning either a negative number, positive number, or zero.
Works similar to
std::memcmp
.Returns a negative value if this stack less than
other
.Returns a positive value if this stack greater than
other
.Returns zero if the stacks are equal.
The returned negative or positive values are not guaranteed to be exactly -1 or 1.
-
inline bool empty() const noexcept
Return
true
if the stack is empty.
-
inline ItemType top() const noexcept
Returns the top of the stack.
Reading the top of an empty stack is undefined behavior.
-
inline void pop() noexcept
Removes the top of the stack.
Popping an empty stack is undefined behavior.
-
inline const ItemType *begin() const noexcept
Returns a pointer to the oldest item in the stack.
If the stack is empty, the returned pointer should not be read or written though can be compared to end().
-
inline SmallStack() noexcept