]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/stack.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStack<T>
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 wxStack<T> is similar to @c std::stack and can be used exactly like it.
13 If wxWidgets is compiled in STL mode, wxStack will just be a typedef to
14 @c std::stack but the advantage of this class is that it is also available
15 on the (rare) platforms where STL is not, so using it makes the code
16 marginally more portable. If you only target the standard desktop
17 platforms, please always use @c std::stack directly instead.
19 The main difference of this class compared to the standard version is that
20 it always uses wxVector<T> as the underlying container and doesn't allow
21 specifying an alternative container type. Another missing part is that the
22 comparison operators between wxStacks are not currently implemented. Other
23 than that, this class is exactly the same as @c std::stack, so please refer
24 to the STL documentation for further information.
29 @see @ref overview_container, wxVector<T>
37 /// Type of the underlying container used.
38 typedef wxVector
<T
> container_type
;
40 /// Type returned by size() method.
41 typedef typename
container_type::size_type size_type
;
43 /// Type of the elements stored in the stack.
44 typedef typename
container_type::value_type value_type
;
48 Stack can be created either empty or initialized with the contents of
49 an existing compatible container.
53 explicit wxStack(const container_type
& cont
);
56 /// Return whether the stack is currently empty.
59 /// Return the number of elements in the stack.
60 size_type
size() const;
63 Return the element on top of the stack.
67 const value_type
& top();
70 /// Adds an element to the stack.
71 void push(const value_type
& val
);
73 /// Removes the element currently on top of the stack.