// stack standard header
#pragma once
#ifndef _STACK_
#define _STACK_
#ifndef RC_INVOKED
#include #ifdef _MSC_VER
#pragma pack(push,_CRT_PACKING)
#pragma warning(push,3)
#endif /* _MSC_VER */
_STD_BEGIN // TEMPLATE CLASS stack
template >
class stack
{ // LIFO queue implemented with a container
public:
typedef _Container container_type;
typedef typename _Container::value_type value_type;
typedef typename _Container::size_type size_type;
typedef typename _Container::reference reference;
typedef typename _Container::const_reference const_reference;stack() : c()
{ // construct with empty container
}explicit stack(const _Container& _Cont) : c(_Cont)
{ // construct by copying specified container
}bool empty() const
{ // test if stack is empty
return (c.empty());
}size_type size() const
{ // test length of stack
return (c.size());
}reference top()
{ // return last element of mutable stack
return (c.back());
}const_reference top() const
{ // return last element of nonmutable stack
return (c.back());
}void push(const value_type& _Val)
{ // insert element at end
c.push_back(_Val);
}void pop()
{ // erase last element
c.pop_back();
}const _Container& _Get_container() const
{ // get reference to container
return (c);
}protected:
_Container c; // the underlying container
}; // stack TEMPLATE FUNCTIONS
template inline bool operator==(const stack<_ty _container>& _Left, const stack<_ty _container>& _Right)
{ // test for stack equality
return (_Left._Get_container() == _Right._Get_container());
}template
inline bool operator!=(const stack<_ty _container>& _Left, const stack<_ty _container>& _Right)
{ // test for stack inequality
return (!(_Left == _Right));
}template
inline bool operator& _Left, const stack<_ty _container>& _Right)
{ // test if _Left
inline bool operator>(const stack<_ty _container>& _Left, const stack<_ty _container>& _Right)
{ // test if _Left > _Right for stacks
return (_Right
inline bool operator& _Left, const stack<_ty _container>& _Right)
{ // test if _Left
inline bool operator>=(const stack<_ty _container>& _Left, const stack<_ty _container>& _Right)
{ // test if _Left >= _Right for stacks
return (!(_Left
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net