2 #ifndef _MADARA_LSTACK_H_
3 #define _MADARA_LSTACK_H_
57 LStack(
size_t size_hint = 0);
71 void push(
const T& new_item);
88 size_t size(
void)
const;
Implements a forward iterator for LStack type classes.
LStackConstIterator(const LStack< T > &stack, size_t pos=0)
Construct an LStackIterator at position pos.
const LStackConstIterator< T > & operator++(void) const
Preincrement operator.
const T & operator*(void) const
Dereference operator returns a const reference to the item contained at the current position.
const LStack< T > & stack_
the stack we are dealing with
bool operator==(const LStackConstIterator< T > &rhs) const
Equality operator.
bool operator!=(const LStackConstIterator< T > &lhs) const
Nonequality operator.
::std::forward_iterator_tag iterator_category
Implements a forward iterator for LStack type classes.
bool operator!=(const LStackIterator< T > &lhs) const
Nonequality operator.
::std::forward_iterator_tag iterator_category
LStackIterator(LStack< T > &stack, size_t pos=0)
Construct an LStackIterator at position pos.
LStackIterator< T > & operator++(void)
Preincrement operator.
bool operator==(const LStackIterator< T > &rhs) const
Equality operator.
T & operator*(void)
Dereference operator returns a reference to the item contained at the current position.
LStack< T > & stack_
the stack we are dealing with
Defines a node in the LStack that's implemented as a linked list.
Exception thrown by methods in this class when an overflow condition occurs.
Exception thrown by methods in this class when an underflow condition occurs.
Defines a generic "last-in/first-out" (LIFO) Abstract Data Type (ADT) using a stack that's implemente...
iterator begin(void)
Get an iterator that points to the beginning of the stack.
void pop_i(void)
Remove the front item on the stack. does not throw exceptions.
LStack(size_t size_hint=0)
Constructor.
~LStack(void)
Perform actions needed when stack goes out of scope.
void push(const T &new_item)
Place a new_item at the tail of the stack.
bool operator==(const LStack< T > &rhs) const
Compare this stack with rhs for equality.
void copy_list(const LStack< T > &rhs)
Copy a linked list of nodes.
void delete_list(void)
Delete a linked list of nodes.
bool is_full(void) const
Returns 1 if the stack is full, otherwise returns 0.
void erase(void)
Delete all the nodes in the LStack.
LStack< T > & operator=(const LStack< T > &rhs)
Assignment operator.
LStackIterator< T > iterator
LStackNode< T > * head_
We only need to keep a single pointer for the circular linked list.
size_t size(void) const
Returns the current number of elements in the stack.
iterator end(void)
Get an iterator that points to the end of the stack.
bool operator!=(const LStack< T > &s) const
T top(void) const
Returns the front stack item without removing it.
size_t count_
Number of items that are currently in the stack.
LStackConstIterator< T > const_iterator
T pop(void)
Remove and return the front item on the stack.
bool is_empty(void) const
Returns 1 if the stack is empty, otherwise returns 0.
Provides utility functions and classes for common tasks and needs.
Copyright(c) 2020 Galois.