windows-nt/Source/XPSP1/NT/base/crts/crtw32/stdhpp64/stack
2020-09-26 16:20:57 +08:00

76 lines
2.1 KiB
Plaintext

// stack standard header
#ifndef _STACK_
#define _STACK_
#include <deque>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
_STD_BEGIN
// TEMPLATE CLASS stack
template<class _Ty, class _C = deque<_Ty> >
class stack {
public:
typedef _C::allocator_type allocator_type;
typedef _C::value_type value_type;
typedef _C::size_type size_type;
explicit stack(const allocator_type& _Al = allocator_type())
: c(_Al) {}
allocator_type get_allocator() const
{return (c.get_allocator()); }
bool empty() const
{return (c.empty()); }
size_type size() const
{return (c.size()); }
value_type& top()
{return (c.back()); }
const value_type& top() const
{return (c.back()); }
void push(const value_type& _X)
{c.push_back(_X); }
void pop()
{c.pop_back(); }
bool operator==(const stack<_Ty, _C>& _X) const
{return (c == _X.c); }
bool operator!=(const stack<_Ty, _C>& _X) const
{return (!(*this == _X)); }
bool operator<(const stack<_Ty, _C>& _X) const
{return (c < _X.c); }
bool operator>(const stack<_Ty, _C>& _X) const
{return (_X < *this); }
bool operator<=(const stack<_Ty, _C>& _X) const
{return (!(_X < *this)); }
bool operator>=(const stack<_Ty, _C>& _X) const
{return (!(*this < _X)); }
protected:
_C c;
};
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _STACK_ */
/*
* Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*/