// deque standard header
#ifndef _DEQUE_
#define _DEQUE_
#include <memory>
#include <stdexcept>

_STD_BEGIN
	// DEQUE PARAMETERS
#define _DEQUEMAPSIZ	8	/* minimum map size, at least 1 */
#define _DEQUESIZ	(sizeof (_Ty) <= 1 ? 16 \
	: sizeof (_Ty) <= 2 ? 8 \
	: sizeof (_Ty) <= 4 ? 4 \
	: sizeof (_Ty) <= 8 ? 2 : 1)	/* elements per block (a power of 2) */

template<class _Ty,
	class _Ax = allocator<_Ty> >
	class deque;

		// TEMPLATE CLASS _Deque_const_iterator
template<class _Ty,
	class _Alloc>
	class _Deque_const_iterator
		: public _Ranit<_Ty, typename _Alloc::difference_type,
			typename _Alloc::const_pointer, typename _Alloc::const_reference>
	{	// iterator for nonmutable vector
public:
	typedef _Deque_const_iterator<_Ty, _Alloc> _Myt;
	typedef deque<_Ty, _Alloc> _Mydeque;

	typedef random_access_iterator_tag iterator_category;
	typedef _Ty value_type;
	typedef typename _Alloc::difference_type difference_type;
	typedef typename _Alloc::const_pointer pointer;
	typedef typename _Alloc::const_reference reference;

	typedef typename _Alloc::size_type size_type;

 #if _HAS_ITERATOR_DEBUGGING
		_Deque_const_iterator()
			{	// construct with null deque pointer
			_Myoff = 0;
			}

		_Deque_const_iterator(const _Myt& _Right)
			: _Myoff(_Right._Myoff)
			{	// construct with copy of _Right
			this->_Adopt(_Right._Mycont);
			}

		_Deque_const_iterator(size_type _Off, const _Container_base *_Pdeque)
			{	// construct with offset _Off in *_Pdeque
			this->_Adopt(_Pdeque);
			_Myoff = _Off;
			}

		reference operator*() const
			{	// return designated object
			size_type _Block = _Myoff / _DEQUESIZ;
			size_type _Off = _Myoff & (_DEQUESIZ - 1);	// assume power of 2
			if (this->_Mycont == 0
				|| _Myoff < ((_Mydeque *)this->_Mycont)->_Myoff
				|| ((_Mydeque *)this->_Mycont)->_Myoff
					+ ((_Mydeque *)this->_Mycont)->_Mysize <= _Myoff)
				_DEBUG_ERROR("deque iterator not dereferencable");
			if (((_Mydeque *)this->_Mycont)->_Mapsize <= _Block)
				_Block -= ((_Mydeque *)this->_Mycont)->_Mapsize;
			return ((((_Mydeque *)this->_Mycont)->_Map)[_Block][_Off]);
			}

 #else /* _HAS_ITERATOR_DEBUGGING */
		_Deque_const_iterator()
			{	// construct with null deque pointer
			this->_Mycont = 0;
			_Myoff = 0;
			}

		_Deque_const_iterator(const _Myt& _Right)
			: _Mycont(_Right._Mycont), _Myoff(_Right._Myoff)
			{	// construct with copy of _Right
			}

		_Deque_const_iterator(size_type _Off, const _Container_base *_Pdeque)
			{	// construct with offset _Off in *_Pdeque
			this->_Mycont = (const _Mydeque *)_Pdeque;
			_Myoff = _Off;
			}

		reference operator*() const
			{	// return designated object
			size_type _Block = _Myoff / _DEQUESIZ;
			size_type _Off = _Myoff & (_DEQUESIZ - 1);	// assume power of 2
			if (this->_Mycont->_Mapsize <= _Block)
				_Block -= this->_Mycont->_Mapsize;
			return ((this->_Mycont->_Map)[_Block][_Off]);
			}
 #endif /* _HAS_ITERATOR_DEBUGGING */

	pointer operator->() const
		{	// return pointer to class object
		return (&**this);
		}

	_Myt& operator++()
		{	// preincrement
		++_Myoff;
		return (*this);
		}

	_Myt operator++(int)
		{	// postincrement
		_Myt _Tmp = *this;
		++*this;
		return (_Tmp);
		}

	_Myt& operator--()
		{	// predecrement
		--_Myoff;
		return (*this);
		}

	_Myt operator--(int)
		{	// postdecrement
		_Myt _Tmp = *this;
		--*this;
		return (_Tmp);
		}

	_Myt& operator+=(difference_type _Off)
		{	// increment by integer
		_Myoff += _Off;
		return (*this);
		}

	_Myt operator+(difference_type _Off) const
		{	// return this + integer
		_Myt _Tmp = *this;
		return (_Tmp += _Off);
		}

	_Myt& operator-=(difference_type _Off)
		{	// decrement by integer
		return (*this += -_Off);
		}

	_Myt operator-(difference_type _Off) const
		{	// return this - integer
		_Myt _Tmp = *this;
		return (_Tmp -= _Off);
		}

	difference_type operator-(const _Myt& _Right) const
		{	// return difference of iterators

 #if _HAS_ITERATOR_DEBUGGING
		_Compat(_Right);
 #endif /* _HAS_ITERATOR_DEBUGGING */

		return (_Right._Myoff <= _Myoff ? _Myoff - _Right._Myoff
			: -(difference_type)(_Right._Myoff - _Myoff));
		}

	reference operator[](difference_type _Off) const
		{	// subscript
		return (*(*this + _Off));
		}

	bool operator==(const _Myt& _Right) const
		{	// test for iterator equality

 #if _HAS_ITERATOR_DEBUGGING
		_Compat(_Right);
		return (_Myoff == _Right._Myoff);
		}

 #else /* _HAS_ITERATOR_DEBUGGING */
		return (this->_Mycont == _Right._Mycont
			&& _Myoff == _Right._Myoff);
	}
 #endif /* _HAS_ITERATOR_DEBUGGING */

	bool operator!=(const _Myt& _Right) const
		{	// test for iterator inequality
		return (!(*this == _Right));
		}

	bool operator<(const _Myt& _Right) const
		{	// test if this < _Right

 #if _HAS_ITERATOR_DEBUGGING
		_Compat(_Right);
		return (_Myoff < _Right._Myoff);
		}

 #else /* _HAS_ITERATOR_DEBUGGING */
		return (this->_Mycont == _Right._Mycont
			&& _Myoff < _Right._Myoff);
	}
 #endif /* _HAS_ITERATOR_DEBUGGING */

	bool operator>(const _Myt& _Right) const
		{	// test if this > _Right
		return (_Right < *this);
		}

	bool operator<=(const _Myt& _Right) const
		{	// test if this <= _Right
		return (!(_Right < *this));
		}

	bool operator>=(const _Myt& _Right) const
		{	// test if this >= _Right
		return (!(*this < _Right));
		}

 #if _HAS_ITERATOR_DEBUGGING
	void _Compat(const _Myt& _Right) const
		{	// test for compatible iterator pair
		if (this->_Mycont == 0 || this->_Mycont != _Right._Mycont)
			_DEBUG_ERROR("deque iterators incompatible");
		}

 #else /* _HAS_ITERATOR_DEBUGGING */
protected:
	const _Mydeque *_Mycont;	// pointer to deque
 #endif /* _HAS_ITERATOR_DEBUGGING */

	size_type _Myoff;	// offset of element in deque
	};

template<class _Ty,
	class _Alloc> inline
	_Deque_const_iterator<_Ty, _Alloc> operator+(
		typename _Deque_const_iterator<_Ty, _Alloc>::difference_type _Off,
		_Deque_const_iterator<_Ty, _Alloc> _Next)
	{	// add offset to iterator
	return (_Next += _Off);
	}

		// TEMPLATE CLASS _Deque_iterator
template<class _Ty,
	class _Alloc>
	class _Deque_iterator
		: public _Deque_const_iterator<_Ty, _Alloc>
		{	// iterator for mutable vector
public:
	typedef _Deque_iterator<_Ty, _Alloc> _Myt;
	typedef _Deque_const_iterator<_Ty, _Alloc> _Mybase;
	typedef deque<_Ty, _Alloc> _Mydeque;

	typedef random_access_iterator_tag iterator_category;
	typedef _Ty value_type;
	typedef typename _Alloc::difference_type difference_type;
	typedef typename _Alloc::pointer pointer;
	typedef typename _Alloc::reference reference;

	typedef typename _Alloc::size_type size_type;

	_Deque_iterator()
		{	// construct with null vector pointer
		}

	_Deque_iterator(size_type _Off, const _Container_base *_Pdeque)
		: _Mybase(_Off, _Pdeque)
		{	// construct with offset _Off in *_Pdeque
		}

	reference operator*() const
		{	// return designated object
		return ((reference)**(_Mybase *)this);
		}

	pointer operator->() const
		{	// return pointer to class object
		return (&**this);
		}

	_Myt& operator++()
		{	// preincrement
		++this->_Myoff;
		return (*this);
		}

	_Myt operator++(int)
		{	// postincrement
		_Myt _Tmp = *this;
		++*this;
		return (_Tmp);
		}

	_Myt& operator--()
		{	// predecrement
		--this->_Myoff;
		return (*this);
		}

	_Myt operator--(int)
		{	// postdecrement
		_Myt _Tmp = *this;
		--*this;
		return (_Tmp);
		}

	_Myt& operator+=(difference_type _Off)
		{	// increment by integer
		this->_Myoff += _Off;
		return (*this);
		}

	_Myt operator+(difference_type _Off) const
		{	// return this + integer
		_Myt _Tmp = *this;
		return (_Tmp += _Off);
		}

	_Myt& operator-=(difference_type _Off)
		{	// decrement by integer
		return (*this += -_Off);
		}

	_Myt operator-(difference_type _Off) const
		{	// return this - integer
		_Myt _Tmp = *this;
		return (_Tmp -= _Off);
		}

	difference_type operator-(const _Mybase& _Right) const
		{	// return difference of iterators
		return (*(_Mybase *)this - _Right);
		}

	reference operator[](difference_type _Off) const
		{	// subscript
		return (*(*this + _Off));
		}
	};

template<class _Ty,
	class _Alloc> inline
	_Deque_iterator<_Ty, _Alloc> operator+(
		typename _Deque_iterator<_Ty, _Alloc>::difference_type _Off,
		_Deque_iterator<_Ty, _Alloc> _Next)
	{	// add offset to iterator
	return (_Next += _Off);
	}

		// TEMPLATE CLASS _Deque_map
template<class _Ty,
	class _Alloc>
	class _Deque_map
		: public _Container_base
	{	// ultimate base class for deque to hold allocator _Almap
protected:
	_Deque_map(_Alloc _Al)
		: _Almap(_Al)
		{	// construct allocator from _Al
		}

	typedef typename _Alloc::template rebind<_Ty>::other _Ty_alloc;
	typedef typename _Ty_alloc::pointer _Tptr;

	typedef typename _Alloc::template rebind<_Tptr>::other
		_Tptr_alloc;
	typedef typename _Tptr_alloc::pointer _Mptr;

	_Tptr_alloc _Almap;	// allocator object for maps
	};

		// TEMPLATE CLASS _Deque_val
template<class _Ty,
	class _Alloc>
	class _Deque_val
		: public _Deque_map<_Ty, _Alloc>
	{	// base class for deque to hold allocator _Alval
protected:
	_Deque_val(_Alloc _Al = _Alloc())
		: _Deque_map<_Ty, _Alloc>(_Al), _Alval(_Al)
		{	// construct allocator and base from _Al
		}

	typedef typename _Alloc::template rebind<_Ty>::other
		_Alty;

	_Alty _Alval;	// allocator object for stored elements
	};

		// TEMPLATE CLASS deque
export
template<class _Ty,
	class _Ax>
	class deque
		: public _Deque_val<_Ty, _Ax>
	{	// circular queue of pointers to blocks
public:

	typedef deque<_Ty, _Ax> _Myt;
	typedef _Deque_val<_Ty, _Ax> _Mybase;
	typedef typename _Mybase::_Alty _Alloc;
	typedef _Alloc allocator_type;
	typedef typename _Alloc::size_type size_type;
	typedef typename _Alloc::difference_type _Dift;
	typedef _Dift difference_type;
	typedef typename _Alloc::pointer _Tptr;
	typedef typename _Alloc::const_pointer _Ctptr;
	typedef _Tptr pointer;
	typedef _Ctptr const_pointer;
	typedef typename _Mybase::_Mptr _Mapptr;
	typedef typename _Alloc::reference _Reft;
	typedef _Reft reference;
	typedef typename _Alloc::const_reference const_reference;
	typedef typename _Alloc::value_type value_type;

	typedef _Deque_iterator<_Ty, _Alloc> iterator;
	typedef _Deque_const_iterator<_Ty, _Alloc> const_iterator;

//	friend class _Deque_iterator<_Ty, _Alloc>;
	friend class _Deque_const_iterator<_Ty, _Alloc>;

	typedef _STD reverse_iterator<iterator> reverse_iterator;
	typedef _STD reverse_iterator<const_iterator> const_reverse_iterator;

	deque()
		: _Mybase(), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct empty deque
		}

	explicit deque(const _Alloc& _Al)
		: _Mybase(_Al), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct empty deque with allocator
		}

	explicit deque(size_type _Count)
		: _Mybase(), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct from _Count * _Ty()
		_Construct_n(_Count, _Ty());
		}

	deque(size_type _Count, const _Ty& _Val)
		: _Mybase(), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct from _Count * _Val
		_Construct_n(_Count, _Val);
		}

	deque(size_type _Count, const _Ty& _Val, const _Alloc& _Al)
		: _Mybase(_Al), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct from _Count * _Val with allocator
		_Construct_n(_Count, _Val);
		}

	deque(const _Myt& _Right)
		: _Mybase(_Right._Alval), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct by copying _Right
		_TRY_BEGIN
		insert(begin(), _Right.begin(), _Right.end());
		_CATCH_ALL
		_Tidy();
		_RERAISE;
		_CATCH_END
		}

	template<class _It>
		deque(_It _First, _It _Last)
		: _Mybase(), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct from [_First, _Last)
		_Construct(_First, _Last, _Iter_cat(_First));
		}

	template<class _It>
		deque(_It _First, _It _Last, const _Alloc& _Al)
		: _Mybase(_Al), _Map(0),
			_Mapsize(0), _Myoff(0), _Mysize(0)
		{	// construct from [_First, _Last) with allocator
		_Construct(_First, _Last, _Iter_cat(_First));
		}

	template<class _It>
		void _Construct(_It _Count, _It _Val, _Int_iterator_tag)
		{	// initialize from _Count * _Val
		_Construct_n((size_type)_Count, (_Ty)_Val);
		}

	template<class _It>
		void _Construct(_It _First, _It _Last, input_iterator_tag)
		{	// initialize from [_First, _Last), input iterators
		_TRY_BEGIN
		insert(begin(), _First, _Last);
		_CATCH_ALL
		_Tidy();
		_RERAISE;
		_CATCH_END
		}

	void _Construct_n(size_type _Count, const _Ty& _Val)
		{	// construct from _Count * _Val
		_TRY_BEGIN
		_Insert_n(begin(), _Count, _Val);
		_CATCH_ALL
		_Tidy();
		_RERAISE;
		_CATCH_END
		}

	~deque()
		{	// destroy the deque
		_Tidy();
		}

	_Myt& operator=(const _Myt& _Right);

	iterator begin()
		{	// return iterator for beginning of mutable sequence
		return (iterator(_Myoff, this));
		}

	const_iterator begin() const
		{	// return iterator for beginning of nonmutable sequence
		return (const_iterator(_Myoff, this));
		}

	iterator end()
		{	// return iterator for end of mutable sequence
		return (iterator(_Myoff + _Mysize, this));
		}

	const_iterator end() const
		{	// return iterator for end of nonmutable sequence
		return (const_iterator(_Myoff + _Mysize, this));
		}

	reverse_iterator rbegin()
		{	// return iterator for beginning of reversed mutable sequence
		return (reverse_iterator(end()));
		}

	const_reverse_iterator rbegin() const
		{	// return iterator for beginning of reversed nonmutable sequence
		return (const_reverse_iterator(end()));
		}

	reverse_iterator rend()
		{	// return iterator for end of reversed mutable sequence
		return (reverse_iterator(begin()));
		}

	const_reverse_iterator rend() const
		{	// return iterator for end of reversed nonmutable sequence
		return (const_reverse_iterator(begin()));
		}

	void resize(size_type _Newsize)
		{	// determine new length, padding with _Ty() elements as needed
		resize(_Newsize, _Ty());
		}

	void resize(size_type _Newsize, _Ty _Val)
		{	// determine new length, padding with _Val elements as needed
		if (_Mysize < _Newsize)
			_Insert_n(end(), _Newsize - _Mysize, _Val);
		else if (_Newsize < _Mysize)
			erase(begin() + _Newsize, end());
		}

	size_type size() const
		{	// return length of sequence
		return (_Mysize);
		}

	size_type max_size() const
		{	// return maximum possible length of sequence
		return (this->_Alval.max_size());
		}

	bool empty() const
		{	// test if sequence is empty
		return (_Mysize == 0);
		}

	allocator_type get_allocator() const
		{	// return allocator object for values
		return (this->_Alval);
		}

	const_reference at(size_type _Pos) const
		{	// subscript nonmutable sequence with checking
		if (_Mysize <= _Pos)
			_Xran();
		return (*(begin() + _Pos));
		}

	reference at(size_type _Pos)
		{	// subscript mutable sequence with checking
		if (_Mysize <= _Pos)
			_Xran();
		return (*(begin() + _Pos));
		}

	const_reference operator[](size_type _Pos) const
		{	// subscript nonmutable sequence

 #if _HAS_ITERATOR_DEBUGGING
		if (_Mysize <= _Pos)
			_DEBUG_ERROR("deque subscript out of range");
 #endif /* _HAS_ITERATOR_DEBUGGING */

		return (*(begin() + _Pos));
		}

	reference operator[](size_type _Pos)
		{	// subscript mutable sequence

 #if _HAS_ITERATOR_DEBUGGING
		if (_Mysize <= _Pos)
			_DEBUG_ERROR("deque subscript out of range");
 #endif /* _HAS_ITERATOR_DEBUGGING */

		return (*(begin() + _Pos));
		}

	reference front()
		{	// return first element of mutable sequence
		return (*begin());
		}

	const_reference front() const
		{	// return first element of nonmutable sequence
		return (*begin());
		}

	reference back()
		{	// return last element of mutable sequence
		return (*(end() - 1));
		}

	const_reference back() const
		{	// return last element of nonmutable sequence
		return (*(end() - 1));
		}

	void push_front(const _Ty& _Val);

	void pop_front();

	void push_back(const _Ty& _Val);

	void pop_back();

	template<class _It>
		void assign(_It _First, _It _Last)
		{	// assign [_First, _Last)
		_Assign(_First, _Last, _Iter_cat(_First));
		}

	template<class _It>
		void _Assign(_It _Count, _It _Val, _Int_iterator_tag)
		{	// assign _Count * _Val
		_Assign_n((size_type)_Count, (_Ty)_Val);
		}

	template<class _It>
		void _Assign(_It _First, _It _Last, input_iterator_tag)
		{	// assign [_First, _Last), input iterators
		erase(begin(), end());
		insert(begin(), _First, _Last);
		}

	void assign(size_type _Count, const _Ty& _Val)
		{	// assign _Count * _Val
		_Assign_n(_Count, _Val);
		}

	iterator insert(iterator _Where, const _Ty& _Val);

	void insert(iterator _Where, size_type _Count, const _Ty& _Val)
		{	// insert _Count * _Val at _Where
		_Insert_n(_Where, _Count, _Val);
		}

	template<class _It>
		void insert(iterator _Where, _It _First, _It _Last)
		{	// insert [_First, _Last) at _Where
		_Insert(_Where, _First, _Last, _Iter_cat(_First));
		}

	template<class _It>
		void _Insert(iterator _Where, _It _Count, _It _Val,
			_Int_iterator_tag)
		{	// insert _Count * _Val at _Where
		_Insert_n(_Where, (size_type)_Count, (_Ty)_Val);
		}

	template<class _It>
		void _Insert(iterator _Where,
			_It _First, _It _Last, input_iterator_tag);

	void _Reverse(size_type _First, size_type _Last)
		{	// reverse a subrange
		for (; _First != _Last && _First != --_Last; ++_First)
			{	// swap distinct _First and _Last
			iterator _Start = begin();
			value_type _Temp = _Start[_First];

			_Start[_First] = _Start[_Last];
			_Start[_Last] = _Temp;
			}
		}

	iterator erase(iterator _Where)
		{	// erase element at _Where
		return (erase(_Where, _Where + 1));
		}

	iterator erase(iterator _First, iterator _Last);

	void clear()
		{	// erase all
		_Tidy();
		}

	void swap(_Myt& _Right)
		{	// exchange contents with _Right
		if (this == &_Right)
			;	// same object, do nothing
		else if (this->_Alval == _Right._Alval)
			{	// same allocator, swap control information

 #if _HAS_ITERATOR_DEBUGGING
			this->_Swap_all(_Right);
 #endif /* _HAS_ITERATOR_DEBUGGING */

			_STD swap(_Map, _Right._Map);
			_STD swap(_Mapsize, _Right._Mapsize);
			_STD swap(_Myoff, _Right._Myoff);
			_STD swap(_Mysize, _Right._Mysize);
			}
		else
			{	// different allocator, do multiple assigns
			_Myt _Ts = *this;

			*this = _Right;
			_Right = _Ts;
			}
		}

protected:
	void _Assign_n(size_type _Count, const _Ty& _Val)
		{	// assign _Count * _Val
		_Ty _Tmp = _Val;	// in case _Val is in sequence
		erase(begin(), end());
		_Insert_n(begin(), _Count, _Tmp);
		}

	void _Insert_n(iterator _Where,
		size_type _Count, const _Ty& _Val);

	void _Xlen() const
		{	// report length error
		_THROW(length_error, "deque<T> too long");
		}

	void _Xran() const
		{	// report range error
		_THROW(out_of_range, "invalid deque<T> subscript");
		}

	void _Growmap(size_type _Count);

	void _Tidy();

 #if _HAS_ITERATOR_DEBUGGING
	void _Orphan_off(size_type _Offlo) const
		{	// orphan iterators with specified offset(s)
		if (_Mysize == 0)
			_DEBUG_ERROR("deque empty before pop");
		size_type _Offhigh = _Myoff + _Mysize <= _Offlo + 1
			? (size_type)(-1) : _Offlo;
		if (_Offlo == _Myoff)
			_Offlo = 0;

		_Lockit _Lock(_LOCK_DEBUG);
		const_iterator **_Pnext = (const_iterator **)&this->_Myfirstiter;
		while (*_Pnext != 0)
			if ((*_Pnext)->_Myoff < _Offlo || _Offhigh < (*_Pnext)->_Myoff)
				_Pnext = (const_iterator **)&(*_Pnext)->_Mynextiter;
			else
				{	// orphan the iterator
				(*_Pnext)->_Mycont = 0;
				*_Pnext = (const_iterator *)(*_Pnext)->_Mynextiter;
				}
		}
 #endif /* _HAS_ITERATOR_DEBUGGING */

	_Mapptr _Map;	// pointer to array of pointers to blocks
	size_type _Mapsize;	// size of map array
	size_type _Myoff;	// offset of initial element
	size_type _Mysize;	// current length of sequence
	};

	// deque TEMPLATE OPERATORS
template<class _Ty,
	class _Alloc> inline
	void swap(deque<_Ty, _Alloc>& _Left, deque<_Ty, _Alloc>& _Right)
	{	// swap _Left and _Right deques
	_Left.swap(_Right);
	}

template<class _Ty,
	class _Alloc> inline
	bool operator==(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test for deque equality
	return (_Left.size() == _Right.size()
		&& equal(_Left.begin(), _Left.end(), _Right.begin()));
	}

template<class _Ty,
	class _Alloc> inline
	bool operator!=(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test for deque inequality
	return (!(_Left == _Right));
	}

template<class _Ty,
	class _Alloc> inline
	bool operator<(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test if _Left < _Right for deques
	return (lexicographical_compare(_Left.begin(), _Left.end(),
		_Right.begin(), _Right.end()));
	}

template<class _Ty,
	class _Alloc> inline
	bool operator<=(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test if _Left <= _Right for deques
	return (!(_Right < _Left));
	}

template<class _Ty,
	class _Alloc> inline
	bool operator>(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test if _Left > _Right for deques
	return (_Right < _Left);
	}

template<class _Ty,
	class _Alloc> inline
	bool operator>=(const deque<_Ty, _Alloc>& _Left,
		const deque<_Ty, _Alloc>& _Right)
	{	// test if _Left >= _Right for deques
	return (!(_Left < _Right));
	}
_STD_END

 #if _HAS_TRADITIONAL_STL
 #define __deque__	deque
 #endif /* _HAS_TRADITIONAL_STL */

#endif /* _DEQUE_ */

/*
 * Copyright (c) 1992-2006 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.
V5.01:1566 */
