HikoGUI
Select Version: ⚠️ This documents the main development branch of HikoGUI. It might differ from release versions.
A low latency retained GUI
|
#include <hikogui/container/stack.hpp>
Public Types | |
using | value_type = T |
using | array_type = std::array<value_type, MaxSize> |
using | pointer = array_type::pointer |
using | const_pointer = array_type::const_pointer |
using | reference = array_type::reference |
using | const_reference = array_type::const_reference |
using | iterator = array_type::iterator |
using | const_iterator = array_type::const_iterator |
using | size_type = array_type::size_type |
using | difference_type = array_type::difference_type |
Public Member Functions | |
stack (stack const &)=delete | |
stack (stack &&)=delete | |
stack & | operator= (stack const &)=delete |
stack & | operator= (stack &&)=delete |
constexpr | stack () noexcept |
Construct an empty stack. | |
constexpr const_pointer | data () const noexcept |
constexpr pointer | data () noexcept |
constexpr iterator | begin () noexcept |
Get an iterator to the first element on the stack. | |
constexpr const_iterator | begin () const noexcept |
Get an iterator to the first element on the stack. | |
constexpr const_iterator | cbegin () const noexcept |
Get an iterator to the first element on the stack. | |
constexpr iterator | end () noexcept |
Get an iterator to the last element on the stack. | |
constexpr const_iterator | end () const noexcept |
Get an iterator to the last element on the stack. | |
constexpr 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. | |
constexpr size_type | size () const noexcept |
The number of elements that fit on the stack. | |
constexpr bool | full () const noexcept |
Check if the stack is full. | |
constexpr bool | empty () const noexcept |
Check if the stack is empty. | |
constexpr reference | operator[] (std::size_t index) noexcept |
Get a reference to an element on the stack at an index. | |
constexpr const_reference | operator[] (std::size_t index) const noexcept |
Get a reference to an element on the stack at an index. | |
constexpr reference | at (std::size_t index) noexcept |
Get a reference to an element on the stack at an index. | |
constexpr const_reference | at (std::size_t index) const noexcept |
Get a reference to an element on the stack at an index. | |
constexpr reference | back () noexcept |
Get a reference to the element at the top of the stack. | |
constexpr const_reference | back () const noexcept |
Get a reference to the element at the top of the stack. | |
template<typename... Args> | |
constexpr 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>) | |
constexpr void | push_back (Arg &&arg) noexcept |
Push a new value to after the current top of the stack. | |
constexpr void | pop_back () noexcept |
Remove the value at the top of the stack. | |
constexpr void | pop_back (const_iterator new_end) noexcept |
Pop elements of the stack through the given iterator. | |
constexpr void | clear () noexcept |
Remove all elements from the stack. | |
A static sized stack.
This stack
class is meant to be used as a relative small object that lives in an automatic variable. The objects in this stack should be mostly trivial, as they will not be destroyed when the stack is popped or cleared.
Because the stack can not grow or shrink, the iterators remain valid over the lifetime of the stack.
|
inlineconstexprnoexcept |
Construct an empty stack.
|
inlineconstexprnoexcept |
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. |
|
inlineconstexprnoexcept |
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. |
|
inlineconstexprnoexcept |
Get a reference to the element at the top of the stack.
Calling back()
on an empty container causes undefined behavior.
|
inlineconstexprnoexcept |
Get a reference to the element at the top of the stack.
Calling back()
on an empty container causes undefined behavior.
|
inlineconstexprnoexcept |
Get an iterator to the first element on the stack.
|
inlineconstexprnoexcept |
Get an iterator to the first element on the stack.
|
inlineconstexprnoexcept |
Get an iterator to the first element on the stack.
|
inlineconstexprnoexcept |
Get an iterator to the last element on the stack.
|
inlineconstexprnoexcept |
Remove all elements from the stack.
|
inlineconstexprnoexcept |
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 . |
|
inlineconstexprnoexcept |
Check if the stack is empty.
|
inlineconstexprnoexcept |
Get an iterator to the last element on the stack.
|
inlineconstexprnoexcept |
Get an iterator to the last element on the stack.
|
inlineconstexprnoexcept |
Check if the stack is full.
|
inlineconstexprnoexcept |
The maximum number of elements that fit on the stack.
|
inlineconstexprnoexcept |
Get a reference to an element on the stack at an index.
No bounds checking is performed.
|
inlineconstexprnoexcept |
Get a reference to an element on the stack at an index.
No bounds checking is performed.
|
inlineconstexprnoexcept |
Remove the value at the top of the stack.
It is undefined behaviour to call this function on an empty stack.
|
inlineconstexprnoexcept |
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. |
|
inlineconstexprnoexcept |
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. |
|
inlineconstexprnoexcept |
The number of elements that fit on the stack.