#include <wx/stack.h>
wxStack<T> is similar to std::stack
and can be used exactly like it.
If wxWidgets is compiled in STL mode, wxStack will just be a typedef to std::stack
but the advantage of this class is that it is also available on the (rare) platforms where STL is not, so using it makes the code marginally more portable. If you only target the standard desktop platforms, please always use std::stack
directly instead.
The main difference of this class compared to the standard version is that it always uses wxVector<T> as the underlying container and doesn't allow specifying an alternative container type. Another missing part is that the comparison operators between wxStacks are not currently implemented. Other than that, this class is exactly the same as std::stack
, so please refer to the STL documentation for further information.
Public Types | |
typedef wxVector< T > | container_type |
Type of the underlying container used. More... | |
typedef container_type::size_type | size_type |
Type returned by size() method. More... | |
typedef container_type::value_type | value_type |
Type of the elements stored in the stack. More... | |
Public Member Functions | |
bool | empty () const |
Return whether the stack is currently empty. More... | |
size_type | size () const |
Return the number of elements in the stack. More... | |
void | push (const value_type &val) |
Adds an element to the stack. More... | |
void | pop () |
Removes the element currently on top of the stack. More... | |
wxStack () | |
Stack can be created either empty or initialized with the contents of an existing compatible container. More... | |
wxStack (const container_type &cont) | |
Stack can be created either empty or initialized with the contents of an existing compatible container. More... | |
value_type & | top () |
Return the element on top of the stack. More... | |
const value_type & | top () |
Return the element on top of the stack. More... | |
typedef wxVector<T> wxStack< T >::container_type |
Type of the underlying container used.
typedef container_type::size_type wxStack< T >::size_type |
Type returned by size() method.
typedef container_type::value_type wxStack< T >::value_type |
Type of the elements stored in the stack.
wxStack< T >::wxStack | ( | ) |
Stack can be created either empty or initialized with the contents of an existing compatible container.
|
explicit |
Stack can be created either empty or initialized with the contents of an existing compatible container.
bool wxStack< T >::empty | ( | ) | const |
Return whether the stack is currently empty.
void wxStack< T >::pop | ( | ) |
Removes the element currently on top of the stack.
void wxStack< T >::push | ( | const value_type & | val | ) |
Adds an element to the stack.
Return the number of elements in the stack.
value_type& wxStack< T >::top | ( | ) |
Return the element on top of the stack.
const value_type& wxStack< T >::top | ( | ) |
Return the element on top of the stack.