2 #ifndef _MADARA_LSTACK_H_ 3 #define _MADARA_LSTACK_H_ 52 LStack (
size_t size_hint = 0);
66 void push (
const T &new_item);
83 size_t size (
void)
const;
102 iterator
begin (
void);
105 const_iterator
begin (
void)
const;
111 const_iterator
end (
void)
const;
142 template <
typename T>
196 template <
typename T>
size_t count_
Number of items that are currently in the stack.
T top(void) const
Returns the front stack item without removing it.
LStack< T > & operator=(const LStack< T > &rhs)
Assignment operator.
bool is_empty(void) const
Returns 1 if the stack is empty, otherwise returns 0.
T pop(void)
Remove and return the front item on the stack.
size_t size(void) const
Returns the current number of elements in the stack.
bool is_full(void) const
Returns 1 if the stack is full, otherwise returns 0.
bool operator==(const LStack< T > &rhs) const
Compare this stack with rhs for equality.
~LStack(void)
Perform actions needed when stack goes out of scope.
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.
auto operator*(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()*rhs.get())
LStack< T > & stack_
the stack we are dealing with
void erase(void)
Delete all the nodes in the LStack.
bool operator!=(const LStack< T > &s) const
::std::forward_iterator_tag iterator_category
::std::forward_iterator_tag iterator_category
Implements a forward iterator for LStack type classes.
void copy_list(const LStack< T > &rhs)
Copy a linked list of nodes.
iterator end(void)
Get an iterator that points to the end of the stack.
Provides utility functions and classes for common tasks and needs.
LStackIterator< T > iterator
Exception thrown by methods in this class when an underflow condition occurs.
LStack(size_t size_hint=0)
Constructor.
Defines a generic "last-in/first-out" (LIFO) Abstract Data Type (ADT) using a stack that's implemente...
Exception thrown by methods in this class when an overflow condition occurs.
Copyright (c) 2015 Carnegie Mellon University.
Implements a forward iterator for LStack type classes.
const LStack< T > & stack_
the stack we are dealing with
Defines a node in the LStack that's implemented as a linked list.
LStackConstIterator< T > const_iterator
void push(const T &new_item)
Place a new_item at the tail of the stack.
LStackNode< T > * head_
We only need to keep a single pointer for the circular linked list.
void delete_list(void)
Delete a linked list of nodes.
auto operator++(Tracked< T > &lhs) -> decltype(++lhs.get_mut())