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