1 // type_traits TR1 header
2 #pragma once
3 #ifndef _TYPE_TRAITS_
4 #define _TYPE_TRAITS_
5 #ifndef RC_INVOKED
6 #include <limits>
7 #include <xtr1common>
8
9     // COMPILER SUPORT MACROS
10
11   #define _IS_BASE_OF(_Base, _Der)    \
12     : _Cat_base<__is_base_of(_Base, _Der)>
13   #define _IS_CONVERTIBLE(_From, _To)    \
14     : _Cat_base<is_void<_From>::value && is_void<_To>::value \
15         || __is_convertible_to(_From, _To)>
16   #define _IS_UNION(_Ty)    : _Cat_base<__is_union(_Ty)>
17   #define _IS_CLASS(_Ty)    : _Cat_base<__is_class(_Ty)>
18   #define _IS_ENUM(_Ty)    : _Cat_base<__is_enum(_Ty)>
19   #define _IS_POD(_Ty)    : _Cat_base<is_void<_Ty>::value \
20     || is_scalar<_Ty>::value \
21     || __has_trivial_constructor(_Ty) && __is_pod(_Ty)>
22   #define _IS_EMPTY(_Ty)    : _Cat_base<__is_empty(_Ty)>
23   #define _IS_POLYMORPHIC(_Ty)    : _Cat_base<__is_polymorphic(_Ty)>
24   #define _IS_ABSTRACT(_Ty)    : _Cat_base<__is_abstract(_Ty)>
25   #define _HAS_TRIVIAL_CONSTRUCTOR(_Ty)    \
26     : _Cat_base<is_pod<_Ty>::value || __has_trivial_constructor(_Ty)>
27   #define _HAS_TRIVIAL_COPY(_Ty)    \
28     : _Cat_base<is_pod<_Ty>::value || __has_trivial_copy(_Ty)>
29   #define _HAS_TRIVIAL_ASSIGN(_Ty)    \
30     : _Cat_base<is_pod<_Ty>::value || __has_trivial_assign(_Ty)>
31   #define _HAS_TRIVIAL_DESTRUCTOR(_Ty)    \
32     : _Cat_base<is_pod<_Ty>::value || __has_trivial_destructor(_Ty)>
33   #define _HAS_NOTHROW_CONSTRUCTOR(_Ty)    \
34     : _Cat_base<is_pod<_Ty>::value || __has_nothrow_constructor(_Ty)>
35   #define _HAS_NOTHROW_COPY(_Ty)    \
36     : _Cat_base<is_pod<_Ty>::value || __has_nothrow_copy(_Ty)>
37   #define _HAS_NOTHROW_ASSIGN(_Ty)    \
38     : _Cat_base<is_pod<_Ty>::value || __has_nothrow_assign(_Ty)>
39   #define _HAS_VIRTUAL_DESTRUCTOR(_Ty)    \
40     : _Cat_base<__has_virtual_destructor(_Ty)>
41
42 _STD_BEGIN
43     namespace tr1 {    // TR1 additions
44
45     // TEMPLATE CLASS _Ptr_traits
46 template<class _Ty>
47     struct _Ptr_traits
48     {    // basic definition
49     };
50
51 template<class _Ty>
52     struct _Ptr_traits<_Ty*>
53     {    // pointer properties
54     static const bool _Is_const = false;
55     static const bool _Is_volatile = false;
Lines 56 ... 854 are skipped.
855 template<class _Ty, unsigned _Nx, unsigned _Ix>
856     struct _Extent<_Ty[_Ix], _Nx>
857     : _Extent<_Ty, _Nx - 1>
858     {    // determine extent of dimension _Nx of array _Ty
859     };
860
861 template<class _Ty, unsigned _Nx>
862     struct _Extent<_Ty[], _Nx>
863     : _Extent<_Ty, _Nx - 1>
864     {    // determine extent of dimension _Nx of array _Ty
865     };
866
867 template<class _Ty, unsigned _Nx = 0>
868     struct extent
869     : _Extent<_Ty, _Nx>
870     {    // determine extent of dimension _Nx of array _Ty
871     };
872
873     // TEMPLATE CLASS is_same
874 template<class _Ty1, class _Ty2>
875     struct is_same
876     : false_type
877     {    // determine whether _Ty1 and _Ty2 are the same type
878     };
879
880 template<class _Ty1>
881     struct is_same<_Ty1, _Ty1>
882     : true_type
883     {    // determine whether _Ty1 and _Ty2 are the same type
884     };
885
886     // TEMPLATE CLASS is_base_of
887 template<class _Base, class _Der>
888     struct is_base_of _IS_BASE_OF(_Base, _Der)
889     {    // determine whether _Base is a base of or the same as _Der
890     };
891
892     }    // namespace tr1
893
894 _STD_END
895
896 #endif /* RC_INVOKED */
897 #endif /* _TYPE_TRAITS_ */
898
899 /*
900  * Copyright (c) 1992-2008 by P.J. Plauger.  ALL RIGHTS RESERVED.
901  * Consult your license regarding permissions and restrictions.
902 V5.05:0009 */
903