A C++ template library for embedded applications
Designed and maintained by
Aster Consulting Ltd

intrusive_stack

An intrusive stack.
STL equivalent: std::stack

etl::intrusive_stack<typename TValue, typename TLink>

TValue is the type that contains the actual values. It is derived from Tlink.
Tlink is the link type for this list. It must contain an etl_next pointer member.
See Intrusive links.

Member types

link_type       TLink
value_type      TValue
size_type       std::size_t
pointer         value_type*
const_pointer   const value_type*
reference       value_type&
const_reference const value_type&

Constructor

etl::stack<typename T, const size_t SIZE>();
Default constructs SIZE elements.

Element access

reference top()
const_reference top() const
Returns a reference or const reference to the element at the top of the stack.

Capacity

bool empty() const
Returns true if the size of the stack is zero, otherwise false.

bool full() const
Returns true if the size of the stack is SIZE, otherwise false.

size_t size() const
Returns the size of the stack.

size_t available() const
Returns the remaining available capacity in the stack.

size_t max_size() const
Returns the maximum possible size of the stack.

size_t capacity() const
Returns the maximum possible size of the stack.

Modifiers

void push(link_type& value);
Pushes a value to the top of the stack.

void pop();
Pop a value from the top of the stack.
Emits an etl::intrusive_stack_empty if the stack is empty and ETL_CHECK_PUSH_POP is defined.

template <typename TContainer>
void pop_into(TContainer& destination);
Pop a value from the top of the stack and push to the destination intrusive container.
The destination container type must support a push(TLink) member function.
Emits an etl::intrusive_stack_empty if the stack is empty and ETL_CHECK_PUSH_POP is defined.

void reverse();
Reverses the stack order.

void clear();
Clears the stack to a size of zero. No elements are destructed.
intrusive_stack.h