williamr@2: /* williamr@2: * williamr@2: * Copyright (c) 1994 williamr@2: * Hewlett-Packard Company williamr@2: * williamr@2: * Copyright (c) 1996,1997 williamr@2: * Silicon Graphics Computer Systems, Inc. williamr@2: * williamr@2: * Copyright (c) 1997 williamr@2: * Moscow Center for SPARC Technology williamr@2: * williamr@2: * Copyright (c) 1999 williamr@2: * Boris Fomitchev williamr@2: * williamr@2: * This material is provided "as is", with absolutely no warranty expressed williamr@2: * or implied. Any use is at your own risk. williamr@2: * williamr@2: * Permission to use or copy this software for any purpose is hereby granted williamr@2: * without fee, provided the above notices are retained on all copies. williamr@2: * Permission to modify the code and to distribute modified code is granted, williamr@2: * provided the above notices are retained, and a notice that the code was williamr@2: * modified is included with the above copyright notice. williamr@2: * williamr@2: */ williamr@2: williamr@2: /* NOTE: This is an internal header file, included by other STL headers. williamr@2: * You should not attempt to use it directly. williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_INTERNAL_STACK_H williamr@2: #define _STLP_INTERNAL_STACK_H williamr@2: williamr@2: #ifndef _STLP_INTERNAL_DEQUE_H williamr@2: # include williamr@2: #endif williamr@2: williamr@2: _STLP_BEGIN_NAMESPACE williamr@2: williamr@2: # if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) williamr@2: template > williamr@2: # elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) williamr@2: # define _STLP_STACK_ARGS _Tp williamr@2: template williamr@2: # else williamr@2: template williamr@2: # endif williamr@2: class stack { williamr@2: williamr@2: # ifdef _STLP_STACK_ARGS williamr@2: typedef deque<_Tp> _Sequence; williamr@2: # endif williamr@2: williamr@2: public: williamr@2: typedef typename _Sequence::value_type value_type; williamr@2: typedef typename _Sequence::size_type size_type; williamr@2: typedef _Sequence container_type; williamr@2: williamr@2: typedef typename _Sequence::reference reference; williamr@2: typedef typename _Sequence::const_reference const_reference; williamr@2: protected: williamr@2: _Sequence c; williamr@2: public: williamr@2: stack() : c() {} williamr@2: explicit stack(const _Sequence& __s) : c(__s) {} williamr@2: williamr@2: bool empty() const { return c.empty(); } williamr@2: size_type size() const { return c.size(); } williamr@2: reference top() { return c.back(); } williamr@2: const_reference top() const { return c.back(); } williamr@2: void push(const value_type& __x) { c.push_back(__x); } williamr@2: void pop() { c.pop_back(); } williamr@2: const _Sequence& _Get_c() const { return c; } williamr@2: }; williamr@2: williamr@2: # ifndef _STLP_STACK_ARGS williamr@2: # define _STLP_STACK_ARGS _Tp, _Sequence williamr@2: # define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence williamr@2: # else williamr@2: # define _STLP_STACK_HEADER_ARGS class _Tp williamr@2: # endif williamr@2: williamr@2: template < _STLP_STACK_HEADER_ARGS > williamr@2: inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y) williamr@2: { williamr@2: return __x._Get_c() == __y._Get_c(); williamr@2: } williamr@2: williamr@2: template < _STLP_STACK_HEADER_ARGS > williamr@2: inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x, const stack< _STLP_STACK_ARGS >& __y) williamr@2: { williamr@2: return __x._Get_c() < __y._Get_c(); williamr@2: } williamr@2: williamr@2: _STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >) williamr@2: williamr@2: _STLP_END_NAMESPACE williamr@2: williamr@2: # undef _STLP_STACK_ARGS williamr@2: # undef _STLP_STACK_HEADER_ARGS williamr@2: williamr@2: #endif /* _STLP_INTERNAL_STACK_H */ williamr@2: williamr@2: // Local Variables: williamr@2: // mode:C++ williamr@2: // End: