LIFO stack container wrapping std::stack. More...
#include <stack.h>
Public Member Functions | |
| Stack ()=default | |
| Default constructor. Creates an empty stack. | |
| Stack (const Stack &other) | |
| Copy constructor. | |
| Stack (Stack &&other) noexcept | |
| Move constructor. | |
| ~Stack ()=default | |
| Destructor. | |
| Stack & | operator= (const Stack &other) |
| Copy assignment operator. | |
| Stack & | operator= (Stack &&other) noexcept |
| Move assignment operator. | |
| bool | isEmpty () const |
| Returns true if the stack has no elements. | |
| size_t | size () const |
| Returns the number of elements. | |
| T & | top () |
| Returns a mutable reference to the top element. | |
| const T & | top () const |
| Returns a const reference to the top element. | |
| const T & | constTop () const |
| Returns a const reference to the top element. | |
| void | push (const T &value) |
| Pushes a value onto the top of the stack. | |
| void | push (T &&value) |
| Pushes a value onto the top of the stack (move overload). | |
| T | pop () |
| Removes and returns the top element. | |
| void | clear () |
| Removes all elements. | |
| void | swap (Stack &other) noexcept |
| Swaps contents with another stack. | |
Friends | |
| bool | operator== (const Stack &lhs, const Stack &rhs) |
| Returns true if both stacks have identical contents. | |
| bool | operator!= (const Stack &lhs, const Stack &rhs) |
| Returns true if the stacks differ. | |
LIFO stack container wrapping std::stack.
Provides a Qt-inspired API over std::stack with consistent naming conventions matching the rest of libpromeki. Simple value type — no PROMEKI_SHARED_FINAL (not typically shared or iterable).
| T | Element type. |
Removes and returns the top element.
Pushes a value onto the top of the stack.
| value | The value to push. |
Pushes a value onto the top of the stack (move overload).
| value | The value to move-push. |
Swaps contents with another stack.
| other | The stack to swap with. |