The stack class is a container adapter that gives the programmer the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.
More...
|
constexpr | stack () |
| Default constructor. Value-initializes the container.
|
|
constexpr | stack (Container &&cont) |
| Move-constructs the underlying container c with cont .
|
|
constexpr | stack (Container const &cont) |
| Copy-constructs the underlying container c with the contents of cont.
|
|
constexpr | stack (stack &&other) noexcept=default |
| Move constructor.
|
|
constexpr | stack (stack const &other)=default |
| Copy constructor.
|
|
template<typename... Args> |
constexpr auto | emplace (Args &&... args) noexcept(noexcept(declval< Container >().emplace_back(etl::forward< Args >(args)...))) -> decltype(auto) |
| Pushes a new element on top of the stack. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element is called with exactly the same arguments as supplied to the function.
|
|
constexpr auto | empty () const noexcept(noexcept(declval< Container >().empty())) -> bool |
| Checks if the underlying container has no elements.
|
|
constexpr auto | pop () noexcept(noexcept(declval< Container >().pop_back())) -> void |
| Removes the top element from the stack.
|
|
constexpr auto | push (value_type &&x) noexcept(noexcept(declval< Container >().push_back(etl::move(x)))) -> void |
| Pushes the given element value to the top of the stack.
|
|
constexpr auto | push (value_type const &x) noexcept(noexcept(declval< Container >().push_back(x))) -> void |
| Pushes the given element value to the top of the stack.
|
|
constexpr auto | size () const noexcept(noexcept(declval< Container >().size())) -> size_type |
| Returns the number of elements in the underlying container.
|
|
constexpr auto | swap (stack &s) noexcept(is_nothrow_swappable_v< Container >) -> void |
| Exchanges the contents of the container adaptor with those of other.
|
|
constexpr auto | top () const noexcept(noexcept(declval< Container >().back())) -> const_reference |
| Returns reference to the top element in the stack. This is the most recently pushed element. This element will be removed on a call to pop().
|
|
constexpr auto | top () noexcept(noexcept(declval< Container >().back())) -> reference |
| Returns reference to the top element in the stack. This is the most recently pushed element. This element will be removed on a call to pop().
|
|
|
constexpr auto | operator!= (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c !=rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
constexpr auto | operator< (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c< rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
constexpr auto | operator<= (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c<=rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
constexpr auto | operator== (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c==rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
constexpr auto | operator> (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c > rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
constexpr auto | operator>= (stack const &lhs, stack const &rhs) noexcept(noexcept(lhs.c >=rhs.c)) -> bool |
| Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
|
|
template<typename T, typename Container>
struct etl::stack< T, Container >
The stack class is a container adapter that gives the programmer the functionality of a stack - specifically, a LIFO (last-in, first-out) data structure.
The class template acts as a wrapper to the underlying container - only a specific set of functions is provided. The stack pushes and pops the element from the back of the underlying container, known as the top of the stack.
template<typename T, typename Container>
template<typename... Args>
auto emplace |
( |
Args &&... | args | ) |
-> decltype(auto)
|
|
inlineconstexprnoexcept |
Pushes a new element on top of the stack. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element is called with exactly the same arguments as supplied to the function.