A statically sized stack with full member access.
More...
#include <ArrayStack.hpp>
|
using | type = ArrayStack< TType, TSize > |
|
using | arrayType = std::array< TType, TSize > |
|
|
size_t | size () const noexcept |
| Gives current stack size. More...
|
|
constexpr size_t | max_size () const noexcept |
| Gives maximum stack size. More...
|
|
void | clear () noexcept |
| Clears the stack. More...
|
|
TType & | operator[] (size_t idx) |
| Returns a reference to the element at idx . More...
|
|
const TType & | operator[] (size_t idx) const |
| Returns a const reference to the element at idx . More...
|
|
void | fill (const TType &value) |
| Fills the stack to full capacity with value . More...
|
|
bool | empty () const noexcept |
| Returns true if stack is empty. More...
|
|
void | push (const TType &value) |
| Pushes value to front of ArrayStack. More...
|
|
void | pop_front () |
| Pops first element. More...
|
|
void | pop_back () |
| Pops last element.
|
|
TType & | front () |
| Returns a reference to the front value in the stack. More...
|
|
const TType & | front () const |
| Returns a const reference to the front value in the stack. More...
|
|
TType & | back () |
| Returns a reference to the rear value in the stack. More...
|
|
const TType & | back () const |
| Returns a const reference to the rear value in the stack. More...
|
|
arrayType::iterator | begin () noexcept |
| Returns an iterator the beginning of the stack. More...
|
|
arrayType::const_iterator | begin () const noexcept |
| Returns a const iterator the beginning of the stack. More...
|
|
arrayType::iterator | end () noexcept |
| Returns an iterator the end of the stack. More...
|
|
arrayType::const_iterator | end () const noexcept |
| Returns a const iterator the end of the stack. More...
|
|
const arrayType & | array () const noexcept |
|
|
static type | zero () |
| Construct a stack filled with the default values of TType . More...
|
|
|
arrayType | array_ |
|
size_t | size_ |
|
template<typename TType, size_t TSize>
struct ls::aux::ArrayStack< TType, TSize >
A statically sized stack with full member access.
- Template Parameters
-
TType | Type of element. |
TSize | Maximum size of stack. |
◆ back() [1/2]
template<typename TType , size_t TSize>
Returns a reference to the rear value in the stack.
Raises out_of_range
exception if the current stack size is 0.
- Returns
- Reference to rear value.
◆ back() [2/2]
template<typename TType , size_t TSize>
Returns a const reference to the rear value in the stack.
Raises out_of_range
exception if the current stack size is 0.
- Returns
- Const reference to rear value.
◆ begin() [1/2]
template<typename TType , size_t TSize>
Returns a const iterator the beginning of the stack.
- Returns
- Const iterator the beginning of the stack.
◆ begin() [2/2]
template<typename TType , size_t TSize>
Returns an iterator the beginning of the stack.
- Returns
- Iterator the beginning of the stack.
◆ clear()
template<typename TType , size_t TSize>
Clears the stack.
Note that this function simply changes the size of the stack to 0, allowing internally stored elements to be overwritten.
◆ empty()
template<typename TType , size_t TSize>
Returns true if stack is empty.
An empty stack is simply one for which size() == 0
.
- Returns
- True if stack is empty.
◆ end() [1/2]
template<typename TType , size_t TSize>
Returns a const iterator the end of the stack.
- Returns
- Const iterator the end of the stack.
◆ end() [2/2]
template<typename TType , size_t TSize>
Returns an iterator the end of the stack.
- Returns
- Iterator the end of the stack.
◆ fill()
template<typename TType , size_t TSize>
Fills the stack to full capacity with value
.
- Parameters
-
value | Value to fill stack with. |
◆ front() [1/2]
template<typename TType , size_t TSize>
Returns a reference to the front value in the stack.
Raises out_of_range
exception if the current stack size is 0.
- Returns
- Reference to front value.
◆ front() [2/2]
template<typename TType , size_t TSize>
Returns a const reference to the front value in the stack.
Raises out_of_range
exception if the current stack size is 0.
- Returns
- Const reference to front value.
◆ max_size()
template<typename TType , size_t TSize>
Gives maximum stack size.
- Returns
- Maximum stack size.
◆ operator[]() [1/2]
template<typename TType , size_t TSize>
Returns a reference to the element at idx
.
This function throws an out_of_range
exception for illegal idx
value (negative, or greater than size).
- Parameters
-
- Returns
- Reference to element at
idx
.
◆ operator[]() [2/2]
template<typename TType , size_t TSize>
Returns a const reference to the element at idx
.
This function throws an out_of_range
exception for illegal idx
value (negative, or greater than size).
- Parameters
-
- Returns
- Const reference to element at
idx
.
◆ pop_front()
template<typename TType , size_t TSize>
Pops first element.
All subsequent values are shifted to the left, and the size is decremented by 1.
◆ push()
template<typename TType , size_t TSize>
Pushes value to front of ArrayStack.
By pushing a value to the front, all other elements are shifted right. If the new size would have been greater than the maximum size, the last element is popped.
- Parameters
-
value | Value to push to front. |
◆ size()
template<typename TType , size_t TSize>
Gives current stack size.
- Returns
- Current stack size.
◆ zero()
template<typename TType , size_t TSize>
Construct a stack filled with the default values of TType
.
- Returns
- Stack filled with default constructed value of
TType
.
The documentation for this struct was generated from the following file: