|
HikoGUI
A low latency retained GUI
|
#include <hikogui/container/stack.hpp>
Public Types | |
| using | value_type = T |
| using | pointer = value_type * |
| using | const_pointer = value_type const * |
| using | reference_type = value_type & |
| using | const_reference_type = value_type const & |
| using | iterator = pointer |
| using | const_iterator = const_pointer |
| using | size_type = std::size_t |
| using | difference_type = ptrdiff_t |
Public Member Functions | |
| stack () noexcept | |
| Construct an empty stack. | |
| stack (std::initializer_list< value_type > init) noexcept | |
| Construct a stack with the given data. | |
| const_pointer | data () const noexcept |
| pointer | data () noexcept |
| iterator | begin () noexcept |
| Get an iterator to the first element on the stack. | |
| const_iterator | begin () const noexcept |
| Get an iterator to the first element on the stack. | |
| const_iterator | cbegin () const noexcept |
| Get an iterator to the first element on the stack. | |
| iterator | end () noexcept |
| Get an iterator to the last element on the stack. | |
| const_iterator | end () const noexcept |
| Get an iterator to the last element on the stack. | |
| const_iterator | cend () const noexcept |
| Get an iterator to the last element on the stack. | |
| constexpr size_type | max_size () const noexcept |
| The maximum number of elements that fit on the stack. | |
| size_type | size () const noexcept |
| The number of elements that fit on the stack. | |
| bool | full () const noexcept |
| Check if the stack is full. | |
| bool | empty () const noexcept |
| Check if the stack is empty. | |
| reference_type | operator[] (std::size_t index) noexcept |
| Get a reference to an element on the stack at an index. | |
| const_reference_type | operator[] (std::size_t index) const noexcept |
| Get a reference to an element on the stack at an index. | |
| reference_type | at (std::size_t index) noexcept |
| Get a reference to an element on the stack at an index. | |
| const_reference_type | at (std::size_t index) const noexcept |
| Get a reference to an element on the stack at an index. | |
| reference_type | back () noexcept |
| Get a reference to the element at the top of the stack. | |
| const_reference_type | back () const noexcept |
| Get a reference to the element at the top of the stack. | |
| template<typename... Args> | |
| void | emplace_back (Args &&...args) noexcept |
| Construct an object after the current top of the stack. | |
| template<typename Arg > requires (std::is_convertible_v<Arg, value_type>) | |
| void | push_back (Arg &&arg) noexcept |
| Push a new value to after the current top of the stack. | |
| void | pop_back () noexcept |
| Remove the value at the top of the stack. | |
| void | pop_back (iterator new_end) noexcept |
| Pop elements of the stack through the given iterator. | |
| void | clear () noexcept |
| Remove all elements from the stack. | |
A static sized stack.
This stack is designed around the functionality of a std::vector, except the data is allocated locally inside the object instead of on the heap.
Because the stack can not grow or shrink, the iterators remain valid over the lifetime of the stack.
|
inlinenoexcept |
Construct an empty stack.
|
inlinenoexcept |
Construct a stack with the given data.
| init | An initializer_list of items to add to the stack. |
|
inlinenoexcept |
Get a reference to an element on the stack at an index.
| std::out_of_range | when the index points beyond the top of the stack. |
|
inlinenoexcept |
Get a reference to an element on the stack at an index.
| std::out_of_range | when the index points beyond the top of the stack. |
|
inlinenoexcept |
Get a reference to the element at the top of the stack.
Calling back() on an empty container causes undefined behavior.
|
inlinenoexcept |
Get a reference to the element at the top of the stack.
Calling back() on an empty container causes undefined behavior.
|
inlinenoexcept |
Get an iterator to the first element on the stack.
|
inlinenoexcept |
Get an iterator to the first element on the stack.
|
inlinenoexcept |
Get an iterator to the first element on the stack.
|
inlinenoexcept |
Get an iterator to the last element on the stack.
|
inlinenoexcept |
Remove all elements from the stack.
|
inlinenoexcept |
Construct an object after the current top of the stack.
| Args | The types of each argument |
| args | The arguments for the constructor of value_type. |
|
inlinenoexcept |
Check if the stack is empty.
|
inlinenoexcept |
Get an iterator to the last element on the stack.
|
inlinenoexcept |
Get an iterator to the last element on the stack.
|
inlinenoexcept |
Check if the stack is full.
|
inlineconstexprnoexcept |
The maximum number of elements that fit on the stack.
|
inlinenoexcept |
Get a reference to an element on the stack at an index.
No bounds checking is performed.
|
inlinenoexcept |
Get a reference to an element on the stack at an index.
No bounds checking is performed.
|
inlinenoexcept |
Remove the value at the top of the stack.
It is undefined behaviour to call this function on an empty stack.
|
inlinenoexcept |
Pop elements of the stack through the given iterator.
Pop elements up to and including the element at new_end.
| new_end | Iterator to the object to be removed. |
|
inlinenoexcept |
Push a new value to after the current top of the stack.
| Arg | The type of an object that can be converted to value_type |
| arg | The object to be pushed on the stack. |
|
inlinenoexcept |
The number of elements that fit on the stack.