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

stack

A fixed capacity stack.
STL equivalent: std::stack

etl::stack<typename T, const size_t SIZE>

Inherits from etl::istack<T>
etl::istack may be used as a size independent pointer or reference type for any etl::stack instance.

Member types

value_type T
size_type  std::size_t

Constructor

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

Element access

T& top()
const T& 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(parameter_t value);
void push();
Pushes a value to the top of the stack. The first pushes a value, the second allocates the new element but does not
initialise it. If the stack is full then emits an etl::stack_full error.

void pop();
Pop a value from the top of the stack.

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