// xmemory internal header (from <memory>)
#ifndef _XMEMORY_
#define _XMEMORY_
#include <use_ansi.h>
#include <cstdlib>
#include <new>
#include <utility>

#ifdef  _MSC_VER
/*
 * Currently, all MS C compilers for Win32 platforms default to 8 byte
 * alignment.
 */
#pragma pack(push,8)
#endif  /* _MSC_VER */

#ifndef _FARQ	/* specify standard memory model */
 #define _FARQ
 #define _PDFT	ptrdiff_t
 #define _SIZT	size_t
#endif
 #define _ALLOCATE_X(T, al2, al, n)		\
	((T _FARQ *)(al)._Charalloc((n) * sizeof (T)))
 #define _CONSTRUCT_X(al2, al, p, v)	_Construct(p, v)
 #define _DEALLOCATE_X(al2, al, p)		(al).deallocate(p)
 #define _DESTROY_X(al2, al, p)			_Destroy(p)
 #define _POINTER_X(T, A)	T _FARQ *
 #define _REFERENCE_X(T, A)	T _FARQ &
		// TEMPLATE FUNCTION _Allocate
template<class _TYPE> inline
	_TYPE _FARQ *_Allocate(_PDFT _N, _TYPE _FARQ *)
	{if (_N < 0)
		_N = 0;
	return ((_TYPE _FARQ *)operator new((_SIZT)_N * sizeof (_TYPE))); }
		// TEMPLATE FUNCTION _Construct
template<class _T1, class _T2> inline
	void _Construct(_T1 _FARQ *_P, const _T2& _V)
	{new ((void _FARQ *)_P) _T1(_V); }
		// TEMPLATE FUNCTION _Destroy
template<class _TYPE> inline
	void _Destroy(_TYPE _FARQ *_P)
	{_DESTRUCTOR(_TYPE, _P); }
inline void _Destroy(char _FARQ *_P)
	{}
inline void _Destroy(wchar_t _FARQ *_P)
	{}
		// TEMPLATE CLASS allocator
template<class _TYPE>
	class allocator {
public:
	typedef _SIZT size_type;
	typedef _PDFT difference_type;
	typedef _TYPE _FARQ *pointer;
	typedef const _TYPE _FARQ *const_pointer;
	typedef _TYPE _FARQ& reference;
	typedef const _TYPE _FARQ& const_reference;
	typedef _TYPE value_type;
	pointer address(reference _X) const
		{return (&_X); }
	const_pointer address(const_reference _X) const
		{return (&_X); }
	pointer allocate(size_type _N, const void *)
		{return (_Allocate((difference_type)_N, (pointer)0)); }
	char _FARQ *_Charalloc(size_type _N)
		{return (_Allocate((difference_type)_N,
			(char _FARQ *)0)); }
	void deallocate(void _FARQ *_P)
		{operator delete(_P); }
	void construct(pointer _P, const _TYPE& _V)
		{_Construct(_P, _V); }
	void destroy(pointer _P)
		{_Destroy(_P); }
	_SIZT max_size() const
		{_SIZT _N = (_SIZT)(-1) / sizeof (_TYPE);
		return (0 < _N ? _N : 1); }
	};
		// CLASS allocator<void>
class allocator<void> {
public:
	typedef void _TYPE;
	typedef _TYPE _FARQ *pointer;
	typedef const _TYPE _FARQ *const_pointer;
	typedef _TYPE value_type;
	};
template<class _TYPE, class _U>
	bool operator==(const allocator<_TYPE>&, const allocator<_U>&)
	{return (true); }

#ifdef  _MSC_VER
#pragma pack(pop)
#endif  /* _MSC_VER */

#endif /* _XMEMORY_ */

/*
 * 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.
 */
