30#ifndef _RWSTD_RW_META_PROP_H_INCLUDED
31#define _RWSTD_RW_META_PROP_H_INCLUDED
41#define _RWSTD_TRAIT_SPEC_0_CV(Trait,Type) \
42 template <> struct Trait<Type> : __rw_true_type { }; \
43 template <> struct Trait<Type const > : __rw_true_type { }; \
44 template <> struct Trait<Type volatile> : __rw_true_type { }; \
45 template <> struct Trait<Type const volatile> : __rw_true_type { }
47template <
class _TypeT>
48struct __rw_is_const : __rw_false_type
52template <
class _TypeT>
53struct __rw_is_const<const _TypeT> : __rw_true_type
57template <
class _TypeT>
58struct __rw_is_volatile : __rw_false_type
62template <
class _TypeT>
63struct __rw_is_volatile<volatile _TypeT> : __rw_true_type
67#if defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x590) \
68 || defined (_MSC_VER) && (_MSC_VER <= 1400)
72template <
class _TypeT>
73struct __rw_is_const<const _TypeT []> : __rw_true_type
77template <
class _TypeT, _RWSTD_SIZE_T _Size>
78struct __rw_is_const<const _TypeT [_Size]> : __rw_true_type
82template <
class _TypeT>
83struct __rw_is_volatile<volatile _TypeT []> : __rw_true_type
87template <
class _TypeT, _RWSTD_SIZE_T _Size>
88struct __rw_is_volatile<volatile _TypeT [_Size]> : __rw_true_type
94#define _RWSTD_IS_CONST(T) _RW::__rw_is_const<T>::value
95#define _RWSTD_IS_VOLATILE(T) _RW::__rw_is_volatile<T>::value
98#if !defined(_RWSTD_TT_IS_POD)
100template <
class _TypeT>
101struct __rw_is_pod_impl
103 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
104 typedef typename __rw_remove_cv<_TypeU>::type _NoCV_TypeU;
106 enum { _C_value = __rw_is_scalar<_NoCV_TypeU>::value };
109# define _RWSTD_IS_POD(T) _RW::__rw_is_pod_impl<T>::_C_value
111#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
113template <
class _TypeT>
114struct __rw_is_pod_impl
116 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
117 typedef typename __rw_remove_cv<_TypeU>::type _NoCV_TypeU;
120 enum { _C_value = __rw_is_scalar<_NoCV_TypeU>::value
121 || _RWSTD_TT_IS_POD(_NoCV_TypeU) };
124# define _RWSTD_IS_POD(T) _RW::__rw_is_pod_impl<T>::_C_value
127# define _RWSTD_IS_POD(T) _RWSTD_TT_IS_POD(T)
130template <
class _TypeT>
132 : __rw_integral_constant<bool, _RWSTD_IS_POD(_TypeT)>
137#if !defined (_RWSTD_TT_IS_STANDARD_LAYOUT)
138# define _RWSTD_IS_STANDARD_LAYOUT(T) _RWSTD_IS_POD(T)
140# define _RWSTD_IS_STANDARD_LAYOUT(T) _RWSTD_TT_IS_STANDARD_LAYOUT(T)
143template <
class _TypeT>
144struct __rw_is_standard_layout
145 : __rw_integral_constant<bool, _RWSTD_IS_STANDARD_LAYOUT(_TypeT)>
151#if defined (_RWSTD_TT_IS_EMPTY)
153# if defined (__EDG_VERSION__) || defined (_MSC_VER)
154# define _RWSTD_IS_EMPTY(T) \
155 (_RWSTD_TT_IS_EMPTY(T) && !_RW::__rw_is_union<T>::value)
157# define _RWSTD_IS_EMPTY(T) _RWSTD_TT_IS_EMPTY(T)
160#elif defined (_RWSTD_TT_IS_CLASS) || defined (_RWSTD_TT_IS_UNION)
168template <class _TypeT, bool = __rw_is_class<_TypeT>::value>
169struct __rw_is_empty_impl
171 struct _C_empty_1 : _TypeT {
long _C_pad [32]; };
172 struct _C_empty_2 {
long _C_pad [32]; };
174 enum { _C_value =
sizeof (_C_empty_1) ==
sizeof (_C_empty_2) };
181template <
class _TypeT>
182struct __rw_is_empty_impl<_TypeT,
false>
184 enum { _C_value = 0 };
187# define _RWSTD_IS_EMPTY(T) _RW::__rw_is_empty_impl<T>::_C_value
192# define _RWSTD_IS_EMPTY(T) 0
195template <
class _TypeT>
197 : __rw_integral_constant<bool, _RWSTD_IS_EMPTY(_TypeT)>
202#if defined (_RWSTD_TT_IS_POLYMORPHIC)
203# define _RWSTD_IS_POLYMORPHIC(T) _RWSTD_TT_IS_POLYMORPHIC(T)
204#elif defined (_RWSTD_TT_IS_CLASS) || defined (_RWSTD_TT_IS_UNION)
213template <class _TypeT, bool = __rw_is_class<_TypeT>::value>
214struct __rw_is_polymorphic_impl
216 template <
class _TypeU>
217 struct _C_type_1 : _TypeU
222 template <
class _TypeU>
223 struct _C_type_2 : _TypeU
225 virtual void _C_method ();
228 enum { _C_value =
sizeof (_C_type_1<_TypeT>)
229 ==
sizeof (_C_type_2<_TypeT>) };
235template <
class _TypeT>
236struct __rw_is_polymorphic_impl<_TypeT,
false>
238 enum { _C_value = 0 };
241# define _RWSTD_IS_POLYMORPHIC(T) \
242 _RW::__rw_is_polymorphic_impl<T>::_C_value
245# define _RWSTD_IS_POLYMORPHIC(T) _RW::__rw_is_class_or_union<T>::value
248template <
class _TypeT>
249struct __rw_is_polymorphic
250 : __rw_integral_constant<bool, _RWSTD_IS_POLYMORPHIC(_TypeT)>
256#if defined (_RWSTD_TT_IS_ABSTRACT)
257# define _RWSTD_IS_ABSTRACT(T) _RWSTD_TT_IS_ABSTRACT(T)
258#elif defined (_RWSTD_TT_IS_CLASS) || defined (_RWSTD_TT_IS_UNION)
265template <class _TypeT, bool = __rw_is_class<_TypeT>::value>
266struct __rw_is_abstract_impl
269 struct _C_yes { _C_no __pad[2]; };
272 static _C_yes _C_is (
int, ...);
275 static _C_no _C_is (
int,
U(*)[1]);
277 enum { _C_value =
sizeof (_C_yes)
278 ==
sizeof (_C_is<_TypeT>(0, 0)) };
285struct __rw_is_abstract_impl<
T,
true>
287 enum { _C_value = 0 };
290# define _RWSTD_IS_ABSTRACT(T) _RW::__rw_is_abstract_impl<T>::_C_value
293# define _RWSTD_IS_ABSTRACT(T) _RW::__rw_is_class_or_union<T>::value
296template <
class _TypeT>
297struct __rw_is_abstract
298 : __rw_integral_constant<bool, _RWSTD_IS_ABSTRACT(_TypeT)>
304#if !defined (_RWSTD_TT_HAS_TRIVIAL_CTOR)
305# define _RWSTD_HAS_TRIVIAL_CTOR(T) _RW::__rw_is_pod<T>::value
306#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
308template <
class _TypeT>
309struct __rw_has_trivial_ctor_impl
311 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
313 enum { _C_value = __rw_is_scalar<_TypeU>::value
314 || _RWSTD_TT_HAS_TRIVIAL_CTOR (_TypeU) };
317# define _RWSTD_HAS_TRIVIAL_CTOR(T) \
318 _RW::__rw_has_trivial_ctor_impl<T>::_C_value
321# define _RWSTD_HAS_TRIVIAL_CTOR(T) _RWSTD_TT_HAS_TRIVIAL_CTOR(T)
324template <
class _TypeT>
325struct __rw_has_trivial_ctor
326 : __rw_integral_constant<bool, _RWSTD_HAS_TRIVIAL_CTOR(_TypeT)>
332#if !defined (_RWSTD_TT_HAS_TRIVIAL_COPY)
333# define _RWSTD_HAS_TRIVIAL_COPY(T) \
334 ( !_RW::__rw_is_array<T>::value \
335 && ( _RW::__rw_is_reference<T>::value \
336 || _RW::__rw_is_pod<T>::value))
337#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
338# define _RWSTD_HAS_TRIVIAL_COPY(T) \
339 ( _RW::__rw_is_reference<T>::value \
340 || _RW::__rw_is_scalar<T>::value \
341 || _RWSTD_TT_HAS_TRIVIAL_COPY(T))
342#elif defined (__GNUG__)
343# define _RWSTD_HAS_TRIVIAL_COPY(T) \
344 (!_RW::__rw_is_array<T>::value && _RWSTD_TT_HAS_TRIVIAL_COPY(T))
346# define _RWSTD_HAS_TRIVIAL_COPY(T) _RWSTD_TT_HAS_TRIVIAL_COPY(T)
349template <
class _TypeT>
350struct __rw_has_trivial_copy
351 : __rw_integral_constant<bool, _RWSTD_HAS_TRIVIAL_COPY(_TypeT)>
356#if !defined (_RWSTD_TT_HAS_TRIVIAL_ASSIGN)
357# define _RWSTD_HAS_TRIVIAL_ASSIGN(T) \
358 ( _RW::__rw_is_pod<T>::value \
359 && !_RW::__rw_is_const<T>::value \
360 && !_RW::__rw_is_reference<T>::value \
361 && !_RW::__rw_is_array<T>::value)
362#elif defined (__EDG_VERSION__)
363# define _RWSTD_HAS_TRIVIAL_ASSIGN(T) \
364 (!_RW::__rw_is_array<T>::value \
365 && !_RW::__rw_is_const<T>::value \
366 && !_RW::__rw_is_reference<T>::value \
367 && (_RW::__rw_is_scalar<T>::value || _RWSTD_TT_HAS_TRIVIAL_ASSIGN(T)))
368#elif defined (__GNUG__)
369# define _RWSTD_HAS_TRIVIAL_ASSIGN(T) \
370 (!_RW::__rw_is_array<T>::value && _RWSTD_TT_HAS_TRIVIAL_ASSIGN(T))
371#elif defined (_MSC_VER)
372# define _RWSTD_HAS_TRIVIAL_ASSIGN(T) \
373 (!_RW::__rw_is_const<T>::value \
374 && (_RW::__rw_is_scalar<T>::value || _RWSTD_TT_HAS_TRIVIAL_ASSIGN(T)))
376# define _RWSTD_HAS_TRIVIAL_ASSIGN(T) _RWSTD_TT_HAS_TRIVIAL_ASSIGN(T)
379template <
class _TypeT>
380struct __rw_has_trivial_assign
381 : __rw_integral_constant<bool, _RWSTD_HAS_TRIVIAL_ASSIGN(_TypeT)>
387#if !defined (_RWSTD_TT_HAS_TRIVIAL_DTOR)
388# define _RWSTD_HAS_TRIVIAL_DTOR(T) \
389 (_RW::__rw_is_pod<T>::value || _RW::__rw_is_reference<T>::value)
390#elif defined (__GNUC__)
391# define _RWSTD_HAS_TRIVIAL_DTOR(T) \
392 ( _RW::__rw_is_reference<_TypeT>::value \
393 || _RWSTD_TT_HAS_TRIVIAL_DTOR (_TypeT))
394#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
396template <
class _TypeT>
397struct __rw_has_trivial_dtor_impl
399 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
401 enum { _C_value = __rw_is_scalar<_TypeU>::value
402 || __rw_is_reference<_TypeU>::value
403 || _RWSTD_TT_HAS_TRIVIAL_DTOR (_TypeU) };
406# define _RWSTD_HAS_TRIVIAL_DTOR(T) \
407 _RW::__rw_has_trivial_dtor_impl<T>::_C_value
410# define _RWSTD_HAS_TRIVIAL_DTOR(T) _RWSTD_TT_HAS_TRIVIAL_DTOR(T)
413template <
class _TypeT>
414struct __rw_has_trivial_dtor
415 : __rw_integral_constant<bool, _RWSTD_HAS_TRIVIAL_DTOR(_TypeT)>
421template <
class _TypeT>
422struct __rw_is_trivial_impl
424 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
425 typedef typename __rw_remove_cv<_TypeU>::type _NoCV_TypeU;
427 enum { _C_value = __rw_is_scalar<_NoCV_TypeU>::value
428 || __rw_has_trivial_ctor<_NoCV_TypeU>::value
429 && __rw_has_trivial_copy<_NoCV_TypeU>::value
430 && __rw_has_trivial_dtor<_NoCV_TypeU>::value
431 && __rw_has_trivial_assign<_NoCV_TypeU>::value
432 && ( __rw_is_class<_NoCV_TypeU>::value
433 || __rw_is_union<_NoCV_TypeU>::value) };
436template <
class _TypeT>
437struct __rw_is_trivial
438 : __rw_integral_constant<bool, __rw_is_trivial_impl<_TypeT>::_C_value>
442#define _RWSTD_IS_TRIVIAL(T) _RW::__rw_is_trivial<T>::value
446#if !defined (_RWSTD_TT_HAS_NOTHROW_CTOR)
447# define _RWSTD_HAS_NOTHROW_CTOR(T) _RW::__rw_has_trivial_ctor<T>::value
448#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
450template <
class _TypeT>
451struct __rw_has_nothrow_ctor_impl
453 typedef typename __rw_remove_all_extents<_TypeT>::type _TypeU;
455 enum { _C_value = __rw_has_trivial_ctor<_TypeT>::value
456 || _RWSTD_TT_HAS_NOTHROW_CTOR (_TypeU) };
459# define _RWSTD_HAS_NOTHROW_CTOR(T) \
460 _RW::__rw_has_nothrow_ctor_impl<T>::_C_value
463# define _RWSTD_HAS_NOTHROW_CTOR(T) _RWSTD_TT_HAS_NOTHROW_CTOR(T)
466template <
class _TypeT>
467struct __rw_has_nothrow_ctor
468 : __rw_integral_constant<bool, _RWSTD_HAS_NOTHROW_CTOR(_TypeT)>
473#if !defined (_RWSTD_TT_HAS_NOTHROW_COPY)
474# define _RWSTD_HAS_NOTHROW_COPY(T) _RW::__rw_has_trivial_copy<T>::value
475#elif defined (__EDG_VERSION__) || defined (_MSC_VER)
476# define _RWSTD_HAS_NOTHROW_COPY(T) \
477 (_RW::__rw_has_trivial_copy<T>::value || _RWSTD_TT_HAS_NOTHROW_COPY(T))
478#elif defined (__GNUG__)
479# define _RWSTD_HAS_NOTHROW_COPY(T) \
480 (!_RW::__rw_is_array<T>::value && _RWSTD_TT_HAS_NOTHROW_COPY(T))
482# define _RWSTD_HAS_NOTHROW_COPY(T) _RWSTD_TT_HAS_NOTHROW_COPY(T)
485template <
class _TypeT>
486struct __rw_has_nothrow_copy
487 : __rw_integral_constant<bool, _RWSTD_HAS_NOTHROW_COPY(_TypeT)>
493#if !defined (_RWSTD_TT_HAS_NOTHROW_ASSIGN)
494# define _RWSTD_HAS_NOTHROW_ASSIGN(T) \
495 _RW::__rw_has_trivial_assign<T>::value
496#elif defined (__EDG_VERSION__)
497# define _RWSTD_HAS_NOTHROW_ASSIGN(T) \
498 (!_RW::__rw_is_const<T>::value \
499 && !_RW::__rw_is_reference<T>::value \
500 && ( _RW::__rw_has_trivial_assign<T>::value \
501 || _RWSTD_TT_HAS_NOTHROW_ASSIGN(T)))
502#elif defined (__GNUG__)
503# define _RWSTD_HAS_NOTHROW_ASSIGN(T) \
504 ( !_RW::__rw_is_array<T>::value \
505 && _RWSTD_TT_HAS_NOTHROW_ASSIGN(T))
506#elif defined (_MSC_VER)
507# define _RWSTD_HAS_NOTHROW_ASSIGN(T) \
508 (!_RW::__rw_is_const<T>::value \
509 && ( _RW::__rw_has_trivial_assign<T>::value \
510 || _RWSTD_TT_HAS_NOTHROW_ASSIGN(T)))
512# define _RWSTD_HAS_NOTHROW_ASSIGN(T) _RWSTD_TT_HAS_NOTHROW_ASSIGN(T)
515template <
class _TypeT>
516struct __rw_has_nothrow_assign
517 : __rw_integral_constant<bool, _RWSTD_HAS_NOTHROW_ASSIGN(_TypeT)>
522#if !defined (_RWSTD_TT_HAS_VIRTUAL_DTOR)
523# define _RWSTD_HAS_VIRTUAL_DTOR(T) _RW::__rw_is_polymorphic<T>::value
525# define _RWSTD_HAS_VIRTUAL_DTOR(T) _RWSTD_TT_HAS_VIRTUAL_DTOR(T)
528template <
class _TypeT>
529struct __rw_has_virtual_dtor
530 : __rw_integral_constant<bool, _RWSTD_HAS_VIRTUAL_DTOR(_TypeT)>
535template <
class _TypeT>
536struct __rw_is_unsigned : __rw_false_type
540template <
class _TypeT>
541struct __rw_is_signed : __rw_false_type
545#if (_RWSTD_CHAR_MIN < 0)
551#ifndef _RWSTD_NO_NATIVE_WCHAR_T
552# if (_RWSTD_WCHAR_MIN < 0)
571#ifndef _RWSTD_NO_LONG_LONG
584#ifndef _RWSTD_NO_LONG_DOUBLE
588#define _RWSTD_IS_SIGNED(T) _RW::__rw_is_signed<T>::value
589#define _RWSTD_IS_UNSIGNED(T) _RW::__rw_is_unsigned<T>::value
593#ifndef _RWSTD_NO_ALIGN_TRAITS
595# if defined (_RWSTD_TT_ALIGN_OF)
596# define _RWSTD_ALIGN_OF(T) _RWSTD_TT_ALIGN_OF(T)
599template <
class _TypeT>
600struct __rw_alignment_of_impl
602 template <
class _TypeU>
605 unsigned char _C_char;
610 sizeof (_C_nest<_TypeT>) -
sizeof (_TypeT) <
sizeof (_TypeT)
611 ?
sizeof (_C_nest<_TypeT>) -
sizeof (_TypeT) <
sizeof (_TypeT)
616struct __rw_alignment_of_impl<void>
618 enum { _C_value = 0 };
622struct __rw_alignment_of_impl<const void>
624 enum { _C_value = 0 };
628struct __rw_alignment_of_impl<volatile void>
630 enum { _C_value = 0 };
634struct __rw_alignment_of_impl<const volatile void>
636 enum { _C_value = 0 };
639# define _RWSTD_ALIGN_OF(T) _RW::__rw_alignment_of_impl<T>::_C_value
642template <
class _TypeT>
643struct __rw_alignment_of
644 : __rw_integral_constant<_RWSTD_SIZE_T, _RWSTD_ALIGN_OF(_TypeT)>
650template <
class _TypeT>
652 : __rw_integral_constant<_RWSTD_SIZE_T, 0>
656template <
class _TypeT, _RWSTD_SIZE_T _Size>
657struct __rw_rank<_TypeT [_Size]>
658 : __rw_integral_constant<_RWSTD_SIZE_T, 1 + __rw_rank<_TypeT>::value>
662#if !defined (__IBMCPP__) || (900 < __IBMCPP__)
664template <
class _TypeT>
665struct __rw_rank<_TypeT []>
666 : __rw_integral_constant<_RWSTD_SIZE_T, 1 + __rw_rank<_TypeT>::value>
672#define _RWSTD_RANK(T) _RW::__rw_rank<T>::value
676template <
class _TypeT, _RWSTD_SIZE_T _Depth>
678 : __rw_integral_constant<_RWSTD_SIZE_T, 0>
682template <
class _TypeT, _RWSTD_SIZE_T _Size, _RWSTD_SIZE_T _Depth>
683struct __rw_extent<_TypeT [_Size], _Depth>
684 : __rw_integral_constant<_RWSTD_SIZE_T,
685 __rw_extent<_TypeT, _Depth - 1>::value>
689#if !defined (__IBMCPP__) || (900 < __IBMCPP__)
691template <
class _TypeT, _RWSTD_SIZE_T _Depth>
692struct __rw_extent<_TypeT [], _Depth>
693 : __rw_integral_constant<_RWSTD_SIZE_T,
694 __rw_extent<_TypeT, _Depth - 1>::value>
700template <
class _TypeT, _RWSTD_SIZE_T _Size>
701struct __rw_extent<_TypeT [_Size], 0>
702 : __rw_integral_constant<_RWSTD_SIZE_T, _Size>
706#if !defined (__IBMCPP__) || (900 < __IBMCPP__)
708template <
class _TypeT>
709struct __rw_extent<_TypeT [], 0>
710 : __rw_integral_constant<_RWSTD_SIZE_T, 0>
716#define _RWSTD_EXTENT(T,D) _RW::__rw_extent<T,D>::value
#define _RWSTD_NAMESPACE(name)