ReactOS 0.4.15-dev-7934-g1dc8d80
_stack.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) 1994
4 * Hewlett-Packard Company
5 *
6 * Copyright (c) 1996,1997
7 * Silicon Graphics Computer Systems, Inc.
8 *
9 * Copyright (c) 1997
10 * Moscow Center for SPARC Technology
11 *
12 * Copyright (c) 1999
13 * Boris Fomitchev
14 *
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
17 *
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
23 *
24 */
25
26/* NOTE: This is an internal header file, included by other STL headers.
27 * You should not attempt to use it directly.
28 */
29
30#ifndef _STLP_INTERNAL_STACK_H
31#define _STLP_INTERNAL_STACK_H
32
33#ifndef _STLP_INTERNAL_DEQUE_H
34# include <stl/_deque.h>
35#endif
36
38
39#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES )
40template <class _Tp, class _Sequence = deque<_Tp> >
41#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS )
42# define _STLP_STACK_ARGS _Tp
43template <class _Tp>
44#else
45template <class _Tp, class _Sequence>
46#endif
47class stack
48#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND)
49# if defined (_STLP_STACK_ARGS)
50 : public __stlport_class<stack<_Tp> >
51# else
52 : public __stlport_class<stack<_Tp, _Sequence> >
53# endif
54#endif
55{
56#ifdef _STLP_STACK_ARGS
57 typedef deque<_Tp> _Sequence;
58 typedef stack<_Tp> _Self;
59#else
61#endif
62
63public:
64 typedef typename _Sequence::value_type value_type;
65 typedef typename _Sequence::size_type size_type;
66 typedef _Sequence container_type;
67
68 typedef typename _Sequence::reference reference;
69 typedef typename _Sequence::const_reference const_reference;
70protected:
71 //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant.
72 _Sequence c;
73public:
74 stack() : c() {}
75 explicit stack(const _Sequence& __s) : c(__s) {}
76
77#if !defined (_STLP_NO_MOVE_SEMANTIC)
80#endif
81
82 bool empty() const { return c.empty(); }
83 size_type size() const { return c.size(); }
84 reference top() { return c.back(); }
85 const_reference top() const { return c.back(); }
86 void push(const value_type& __x) { c.push_back(__x); }
87 void pop() { c.pop_back(); }
88 const _Sequence& _Get_s() const { return c; }
89#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
90 void _M_swap_workaround(_Self& __x) {
91 _Sequence __tmp = c;
92 c = __x.c;
93 __x.c = __tmp;
94 }
95#endif
96};
97
98#ifndef _STLP_STACK_ARGS
99# define _STLP_STACK_ARGS _Tp, _Sequence
100# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence
101#else
102# define _STLP_STACK_HEADER_ARGS class _Tp
103#endif
104
105template < _STLP_STACK_HEADER_ARGS >
107 const stack< _STLP_STACK_ARGS >& __y)
108{ return __x._Get_s() == __y._Get_s(); }
109
110template < _STLP_STACK_HEADER_ARGS >
112 const stack< _STLP_STACK_ARGS >& __y)
113{ return __x._Get_s() < __y._Get_s(); }
114
115_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >)
116
117#undef _STLP_STACK_ARGS
118#undef _STLP_STACK_HEADER_ARGS
119
120#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
121template <class _Tp, class _Sequence>
122struct __move_traits<stack<_Tp, _Sequence> > :
124{};
125#endif
126
128
129#endif /* _STLP_INTERNAL_STACK_H */
130
131// Local Variables:
132// mode:C++
133// End:
#define _STLP_CALL
Definition: _bc.h:131
#define _STLP_PRIV
Definition: _dm.h:70
_STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits< _Tp >::_Type _AsMoveSource(_Tp &src)
#define _STLP_STACK_ARGS
Definition: _stack.h:99
bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS > &__x, const stack< _STLP_STACK_ARGS > &__y)
Definition: _stack.h:111
bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS > &__x, const stack< _STLP_STACK_ARGS > &__y)
Definition: _stack.h:106
void get(int argc, const char *argv[])
Definition: cmds.c:480
Definition: _deque.h:404
Definition: _stack.h:55
stack(__move_source< _Self > src)
Definition: _stack.h:78
stack< _Tp, _Sequence > _Self
Definition: _stack.h:60
bool empty() const
Definition: _stack.h:82
_Sequence c
Definition: _stack.h:72
reference top()
Definition: _stack.h:84
_Sequence container_type
Definition: _stack.h:66
_Sequence::reference reference
Definition: _stack.h:68
_Sequence::value_type value_type
Definition: _stack.h:64
void push(const value_type &__x)
Definition: _stack.h:86
void pop()
Definition: _stack.h:87
const _Sequence & _Get_s() const
Definition: _stack.h:88
stack(const _Sequence &__s)
Definition: _stack.h:75
const_reference top() const
Definition: _stack.h:85
_Sequence::const_reference const_reference
Definition: _stack.h:69
_Sequence::size_type size_type
Definition: _stack.h:65
stack()
Definition: _stack.h:74
size_type size() const
Definition: _stack.h:83
#define _STLP_RELOPS_OPERATORS(_TMPL, _TP)
Definition: features.h:1039
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
GLenum src
Definition: glext.h:6340
const GLubyte * c
Definition: glext.h:8905
if(dx< 0)
Definition: linetemp.h:194