|
|
| Stack (Stack< T > &&stack) |
| |
|
Stack< T > & | operator= (Stack< T > &&stack) |
| |
|
void | clear () |
| | Clears the stack.
|
| |
| bool | is_empty () const |
| | Checks if the stack is empty. More...
|
| |
| void | push (const T &value) |
| | Adds an element at the top of the stack. More...
|
| |
| T | pop () |
| | Removes the element at the top of the stack. More...
|
| |
|
| static Stack< T > | from_range (const T &a, const T &b, const T &step) |
| | Creates a stack from all elements ranging between certain values. More...
|
| |
◆ from_range()
Creates a stack from all elements ranging between certain values.
- Parameters
-
| [in] | a | start of the count |
| [in] | b | count limit |
| [in] | step | count step |
- Returns
- A stack containing a, a+step, ..., up to b, not including b
This method is only available with aritmetic types: Stack<int>::from_range(). For example, Stack<Pizza>::from_range() raises a syntax error.
A type is considered arithmetic if it allows for addition (+), substraction (-), comparison ( <, >) and has a "zero" element (x+0=x, x-0=x).
Extra care is needed when choosing the step
static Stack< T > from_range(const T &a, const T &b, const T &step)
Creates a stack from all elements ranging between certain values.
Definition: stack.hpp:137
◆ is_empty()
Checks if the stack is empty.
- Returns
- true is stack contains no elements, false otherwise
◆ pop()
Removes the element at the top of the stack.
- Returns
- The popped element
◆ push()
Adds an element at the top of the stack.
- Parameters
-
| [in] | value | Element to be added
|
The documentation for this class was generated from the following file: