stack is a base class implementing a stack. It cannot be instantiated on it's own since it's missing the mechanism for getting new nodes.
More...
#include <ds_types_stack.h>
|
| stack () |
| Creates an empty stack.
|
|
| stack (const stack &rhs)=delete |
|
void | clear (void) |
| Clears the stack (removes all elements).
|
|
size_t | capacity (void) const |
| Returns the capacity of the stack.
|
|
size_t | size (void) const |
| Returns the current size of the stack.
|
|
bool | push (const T &item) |
| Pushes an element on the stack.
|
|
T | pop (void) |
| Pops the element on the top of the stack. If the stack is empty, this is undefined behaviour.
|
|
T | top (void) const |
| Returns the element on the top of the stack without popping it. If the stack is empty, this is undefined behaviour.
|
|
const T * | findFirst (const T &item) const |
| Finds the first occurence of the specified element.
|
|
int32_t | findFirstIndex (const T &item) const |
| Finds the first occurence of the specified element.
|
|
const T * | findLast (const T &item) const |
| Finds the last occurence of the specified element.
|
|
int32_t | findLastIndex (const T &item) const |
| Finds the last occurence of the specified element.
|
|
|
virtual T * | getMemory (void)=0 |
|
virtual size_t | getCapacity (void) const =0 |
|
|
T * | mArray |
|
size_t | mCapacity |
|
template<typename T>
class stack< T >
stack is a base class implementing a stack. It cannot be instantiated on it's own since it's missing the mechanism for getting new nodes.
◆ capacity()
template<typename T >
size_t stack< T >::capacity |
( |
void |
| ) |
const |
|
inline |
Returns the capacity of the stack.
- Returns
- Number of elements the stack can store
◆ findFirst()
template<typename T >
const T * stack< T >::findFirst |
( |
const T & |
item | ) |
const |
|
inline |
Finds the first occurence of the specified element.
- Returns
- Pointer the to element if it was found, nullptr otherwise
◆ findFirstIndex()
template<typename T >
int32_t stack< T >::findFirstIndex |
( |
const T & |
item | ) |
const |
|
inline |
Finds the first occurence of the specified element.
- Returns
- Position of the element if it was found, -1 otherwise
◆ findLast()
template<typename T >
const T * stack< T >::findLast |
( |
const T & |
item | ) |
const |
|
inline |
Finds the last occurence of the specified element.
- Returns
- Pointer the to element if it was found, nullptr otherwise
◆ findLastIndex()
template<typename T >
int32_t stack< T >::findLastIndex |
( |
const T & |
item | ) |
const |
|
inline |
Finds the last occurence of the specified element.
- Returns
- Position of the element if it was found, -1 otherwise
◆ pop()
template<typename T >
T stack< T >::pop |
( |
void |
| ) |
|
|
inline |
Pops the element on the top of the stack. If the stack is empty, this is undefined behaviour.
- Returns
- Popped element
◆ push()
template<typename T >
bool stack< T >::push |
( |
const T & |
item | ) |
|
|
inline |
Pushes an element on the stack.
- Parameters
-
- Returns
- True if the element was pushed successfully, false if the stack is full and the element could not be pushed
◆ size()
template<typename T >
size_t stack< T >::size |
( |
void |
| ) |
const |
|
inline |
Returns the current size of the stack.
- Returns
- Current size of the stack (number of elements in the stack)
◆ top()
template<typename T >
T stack< T >::top |
( |
void |
| ) |
const |
|
inline |
Returns the element on the top of the stack without popping it. If the stack is empty, this is undefined behaviour.
- Returns
- Element on the top of the stack
The documentation for this class was generated from the following file: