snippets 0.1.0
|
#include <monotonic_stack.hpp>
Public Member Functions | |
std::optional< T > | push (const T &value) |
const T & | top () const |
bool | empty () const |
A stack that maintains a monotonic order based on a comparator.
T | The type of elements in the stack. |
Comparator | The comparator that defines the monotonic order. |
|
inline |
Checks if the stack is empty.
|
inline |
Pushes a value onto the stack. Values not meeting the monotonic condition are popped.
value | The value to be pushed. |
|
inline |
Returns the top value of the stack.