File: stack.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (74 lines) | stat: -rw-r--r-- 2,369 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/stack.h
// Purpose:     interface of wxStack<T>
// Author:      Vadim Zeitlin
// Copyright:   (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    wxStack<T> is similar to @c std::stack and can be used exactly like it.

    If wxWidgets is compiled in STL mode, wxStack will just be a typedef to
    @c 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 @c 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 @c std::stack, so please refer
    to the STL documentation for further information.

    @nolibrary
    @category{containers}

    @see @ref overview_container, wxVector<T>

    @since 2.9.2
*/
template <typename T>
class wxStack<T>
{
public:
    /// Type of the underlying container used.
    typedef wxVector<T> container_type;

    /// Type returned by size() method.
    typedef typename container_type::size_type size_type;

    /// Type of the elements stored in the stack.
    typedef typename container_type::value_type value_type;


    /**
        Stack can be created either empty or initialized with the contents of
        an existing compatible container.
     */
    //@{
    wxStack();
    explicit wxStack(const container_type& cont);
    //@}

    /// Return whether the stack is currently empty.
    bool empty() const;

    /// Return the number of elements in the stack.
    size_type size() const;

    /**
        Return the element on top of the stack.
     */
    //@{
    value_type& top();
    const value_type& top();
    //@}

    /// Adds an element to the stack.
    void push(const value_type& val);

    /// Removes the element currently on top of the stack.
    void pop();
};