49 d = std::move(
other.d);
56 bool isEmpty()
const {
return d.empty(); }
59 size_t size()
const {
return d.size(); }
64 T &
top() {
return d.top(); }
67 const T &
top()
const {
return d.top(); }
88 d.push(std::move(
value));
97 T val = std::move(d.top());
104 while(!d.empty()) d.pop();
Dynamic array container wrapping std::vector.
Definition list.h:40
LIFO stack container wrapping std::stack.
Definition stack.h:27
Stack & operator=(Stack &&other) noexcept
Move assignment operator.
Definition stack.h:48
bool isEmpty() const
Returns true if the stack has no elements.
Definition stack.h:56
void clear()
Removes all elements.
Definition stack.h:103
~Stack()=default
Destructor.
Stack()=default
Default constructor. Creates an empty stack.
friend bool operator!=(const Stack &lhs, const Stack &rhs)
Returns true if the stacks differ.
Definition stack.h:123
friend bool operator==(const Stack &lhs, const Stack &rhs)
Returns true if both stacks have identical contents.
Definition stack.h:120
Stack(Stack &&other) noexcept
Move constructor.
Definition stack.h:36
void push(const T &value)
Pushes a value onto the top of the stack.
Definition stack.h:78
Stack & operator=(const Stack &other)
Copy assignment operator.
Definition stack.h:42
Stack(const Stack &other)
Copy constructor.
Definition stack.h:33
T & top()
Returns a mutable reference to the top element.
Definition stack.h:64
void swap(Stack &other) noexcept
Swaps contents with another stack.
Definition stack.h:112
T pop()
Removes and returns the top element.
Definition stack.h:96
size_t size() const
Returns the number of elements.
Definition stack.h:59
const T & top() const
Returns a const reference to the top element.
Definition stack.h:67
void push(T &&value)
Pushes a value onto the top of the stack (move overload).
Definition stack.h:87
const T & constTop() const
Returns a const reference to the top element.
Definition stack.h:70
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
const T & value(const Result< T > &r)
Returns the value from a Result.
Definition result.h:56