// xstddef standard header
#ifndef _XSTDDEF_
#define _XSTDDEF_
#include <yvals.h>

 #if !defined(_XSTD)
  #define _X_STD_BEGIN	_STD_BEGIN
  #define _X_STD_END	_STD_END
  #define _XSTD	_STD /* LEAVE SPACE */
 #endif /* !defined(_XSTD) */

 #if _HAS_INITIALIZER_LISTS
 #include <initializer_list>
 #endif /* _HAS_INITIALIZER_LISTS */

#include <cstddef>

_STD_BEGIN
		// EXCEPTION MACROS

 #if _HAS_EXCEPTIONS
 #define _TRY_BEGIN	try {
 #define _CATCH(x)	} catch (x) {
 #define _CATCH_ALL	} catch (...) {
 #define _CATCH_END	}

 #define _RAISE(x)	throw x
 #define _RERAISE	throw

 #ifndef _THROWS
  #define _THROWS(x)	throw (x)
 #endif /* _THROWS */

  #define _THROW0()		throw ()
  #define _THROW1(x)	throw x

  #define _THROW(x, y)		throw x(y)
  #define _THROW_NCEE(x, y)	throw x(y)

 #else /* _HAS_EXCEPTIONS */
 #define _TRY_BEGIN	{{
 #define _CATCH(x)	} if (0) {
 #define _CATCH_ALL	} if (0) {
 #define _CATCH_END	}}

  #define _RAISE(x)	_XSTD _Throw(x)

 #define _RERAISE

 #ifndef _THROWS
  #define _THROWS(x)
 #endif /* _THROWS */

 #define _THROW0()
 #define _THROW1(x)
 #define _THROW(x, y)		x(y)._Raise()
 #define _THROW_NCEE(x, y)	x(y)._Raise()
 #endif /* _HAS_EXCEPTIONS */

		// MISCELLANEOUS MACROS
#define _EMPTY_ARGUMENT		/* for empty throw argument */

		// BITMASK MACROS
 #define _BITMASK(Enum, Ty)	typedef Enum Ty

 #define _BITMASK_OPS(Ty) \
inline Ty& operator&=(Ty& _Left, Ty _Right) \
	{	/* return _Left &= _Right */ \
	_Left = (Ty)((int)_Left & (int)_Right); return _Left; \
	} \
\
inline Ty& operator|=(Ty& _Left, Ty _Right) \
	{	/* return _Left |= _Right */ \
	_Left = (Ty)((int)_Left | (int)_Right); return _Left; \
	} \
\
inline Ty& operator^=(Ty& _Left, Ty _Right) \
	{	/* return _Left &= _Right */ \
	_Left = (Ty)((int)_Left ^ (int)_Right); return _Left; \
	} \
\
inline _CONST_FUN Ty operator&(Ty _Left, Ty _Right) \
	{	/* return _Left & _Right */ \
	return ((Ty)((int)_Left & (int)_Right)); \
	} \
\
inline _CONST_FUN Ty operator|(Ty _Left, Ty _Right) \
	{	/* return _Left | _Right */ \
	return ((Ty)((int)_Left | (int)_Right)); \
	} \
\
inline _CONST_FUN Ty operator^(Ty _Left, Ty _Right) \
	{	/* return _Left ^ _Right */ \
	return ((Ty)((int)_Left ^ (int)_Right)); \
	} \
\
inline _CONST_FUN Ty operator~(Ty _Left) \
	{	/* return ~_Left */ \
	return ((Ty)~(int)_Left); \
	}

		// TYPE DEFINITIONS
template<bool _Test,
	class _Ty1,
	class _Ty2>
	class _If
	{	// _Type is _Ty2 for assumed false
public:
	typedef _Ty2 _Type;
	};

template<class _Ty1,
	class _Ty2>
	class _If<true, _Ty1, _Ty2>
	{	// _Type is _Ty1 for assumed true
public:
	typedef _Ty1 _Type;
	};

 #ifndef _IS_YES
  #define _IS_YES(ty)	(sizeof (ty) == sizeof (_STD tr1::_Yes))

	namespace tr1 {
typedef char (&_No)[1];
typedef char (&_Yes)[2];
	}	// namespace tr1
 #endif /* _IS_YES */

 #ifndef _CONVERTIBLE_TO_TRUE

 #if 1400 <= _MSC_VER
  #define _CONVERTIBLE_TO_TRUE	(&_STD _Bool_struct::_Member)
  #define _OPERATOR_BOOL	operator _STD _Bool_type

struct _Bool_struct
	{	// define member just for its address
	int _Member;
	};

typedef int _Bool_struct::* _Bool_type;

 #else /* 1400 <= _MSC_VER */
  #define _CONVERTIBLE_TO_TRUE	1
  #define _OPERATOR_BOOL	operator bool
 #endif /* 1400 <= _MSC_VER */

 #endif /* _CONVERTIBLE_TO_TRUE */

 #ifndef _STATIC_ASSERT2
  #define _STATIC_ASSERT2(test, mesg)	\
	((void)_STD _Static_assert<test>(mesg))

template<bool>
	struct _Static_assert {
	_Static_assert(const char *)
		{	// construct from message
		};
	};

template<>
	struct _Static_assert<false>;	// leave undefined
 #endif /* _STATIC_ASSERT2 */

		//	FUNCTIONAL STUFF (from <functional>)
		// TEMPLATE STRUCT unary_function
template<class _Arg,
	class _Result>
	struct unary_function
	{	// base class for unary functions
	typedef _Arg argument_type;
	typedef _Result result_type;
	};

		// TEMPLATE STRUCT binary_function
template<class _Arg1,
	class _Arg2,
	class _Result>
	struct binary_function
	{	// base class for binary functions
	typedef _Arg1 first_argument_type;
	typedef _Arg2 second_argument_type;
	typedef _Result result_type;
	};
_STD_END
#endif /* _XSTDDEF_ */

/*
 * Copyright (c) 1992-2010 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V5.30:0009 */
