1 |
|
---|
2 | // Copyright 2001-2003 Aleksey Gurtovoy.
|
---|
3 | // Use, modification and distribution are subject to the Boost Software License,
|
---|
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
5 | // http://www.boost.org/LICENSE_1_0.txt).
|
---|
6 | //
|
---|
7 | // See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
---|
8 |
|
---|
9 | #ifndef BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED
|
---|
10 | #define BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED
|
---|
11 |
|
---|
12 | #include "boost/mpl/aux_/lambda_support.hpp"
|
---|
13 | #include "boost/config.hpp"
|
---|
14 |
|
---|
15 | // these are needed regardless of BOOST_TT_NO_BROKEN_COMPILER_SPEC
|
---|
16 | #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
---|
17 | namespace boost { namespace detail {
|
---|
18 | template< typename T > struct remove_const_impl { typedef T type; };
|
---|
19 | template< typename T > struct remove_volatile_impl { typedef T type; };
|
---|
20 | template< typename T > struct remove_pointer_impl { typedef T type; };
|
---|
21 | template< typename T > struct remove_reference_impl { typedef T type; };
|
---|
22 | typedef int invoke_BOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces;
|
---|
23 | }}
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | // agurt, 27/jun/03: disable the workaround if user defined
|
---|
27 | // BOOST_TT_NO_BROKEN_COMPILER_SPEC
|
---|
28 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
---|
29 | || defined(BOOST_TT_NO_BROKEN_COMPILER_SPEC)
|
---|
30 |
|
---|
31 | # define BOOST_TT_BROKEN_COMPILER_SPEC(T) /**/
|
---|
32 |
|
---|
33 | #else
|
---|
34 |
|
---|
35 | // same as BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 macro, except that it
|
---|
36 | // never gets #undef-ined
|
---|
37 | # define BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(trait,spec,result) \
|
---|
38 | template<> struct trait##_impl<spec> \
|
---|
39 | { \
|
---|
40 | typedef result type; \
|
---|
41 | }; \
|
---|
42 | /**/
|
---|
43 |
|
---|
44 | # define BOOST_TT_AUX_REMOVE_CONST_VOLATILE_RANK1_SPEC(T) \
|
---|
45 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_const,T const,T) \
|
---|
46 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_const,T const volatile,T volatile) \
|
---|
47 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T volatile,T) \
|
---|
48 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T const volatile,T const) \
|
---|
49 | /**/
|
---|
50 |
|
---|
51 | # define BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T) \
|
---|
52 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*,T) \
|
---|
53 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*const,T) \
|
---|
54 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*volatile,T) \
|
---|
55 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*const volatile,T) \
|
---|
56 | BOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_reference,T&,T) \
|
---|
57 | /**/
|
---|
58 |
|
---|
59 | # define BOOST_TT_AUX_REMOVE_PTR_REF_RANK_2_SPEC(T) \
|
---|
60 | BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T) \
|
---|
61 | BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T const) \
|
---|
62 | BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T volatile) \
|
---|
63 | BOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T const volatile) \
|
---|
64 | /**/
|
---|
65 |
|
---|
66 | # define BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T) \
|
---|
67 | BOOST_TT_AUX_REMOVE_PTR_REF_RANK_2_SPEC(T) \
|
---|
68 | BOOST_TT_AUX_REMOVE_CONST_VOLATILE_RANK1_SPEC(T) \
|
---|
69 | /**/
|
---|
70 |
|
---|
71 | # define BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T) \
|
---|
72 | BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T*) \
|
---|
73 | BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T const*) \
|
---|
74 | BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T volatile*) \
|
---|
75 | BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T const volatile*) \
|
---|
76 | /**/
|
---|
77 |
|
---|
78 | # define BOOST_TT_BROKEN_COMPILER_SPEC(T) \
|
---|
79 | namespace boost { namespace detail { \
|
---|
80 | typedef invoke_BOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces \
|
---|
81 | please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces; \
|
---|
82 | BOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T) \
|
---|
83 | BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T) \
|
---|
84 | BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T*) \
|
---|
85 | BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const*) \
|
---|
86 | BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T volatile*) \
|
---|
87 | BOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const volatile*) \
|
---|
88 | }} \
|
---|
89 | /**/
|
---|
90 |
|
---|
91 | # include "boost/type_traits/detail/type_trait_undef.hpp"
|
---|
92 |
|
---|
93 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
---|
94 |
|
---|
95 | BOOST_TT_BROKEN_COMPILER_SPEC(bool)
|
---|
96 | BOOST_TT_BROKEN_COMPILER_SPEC(char)
|
---|
97 | #ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
---|
98 | BOOST_TT_BROKEN_COMPILER_SPEC(wchar_t)
|
---|
99 | #endif
|
---|
100 | BOOST_TT_BROKEN_COMPILER_SPEC(signed char)
|
---|
101 | BOOST_TT_BROKEN_COMPILER_SPEC(unsigned char)
|
---|
102 | BOOST_TT_BROKEN_COMPILER_SPEC(signed short)
|
---|
103 | BOOST_TT_BROKEN_COMPILER_SPEC(unsigned short)
|
---|
104 | BOOST_TT_BROKEN_COMPILER_SPEC(signed int)
|
---|
105 | BOOST_TT_BROKEN_COMPILER_SPEC(unsigned int)
|
---|
106 | BOOST_TT_BROKEN_COMPILER_SPEC(signed long)
|
---|
107 | BOOST_TT_BROKEN_COMPILER_SPEC(unsigned long)
|
---|
108 | BOOST_TT_BROKEN_COMPILER_SPEC(float)
|
---|
109 | BOOST_TT_BROKEN_COMPILER_SPEC(double)
|
---|
110 | //BOOST_TT_BROKEN_COMPILER_SPEC(long double)
|
---|
111 |
|
---|
112 | // for backward compatibility
|
---|
113 | #define BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \
|
---|
114 | BOOST_TT_BROKEN_COMPILER_SPEC(T) \
|
---|
115 | /**/
|
---|
116 |
|
---|
117 | #endif // BOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED
|
---|