Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 9 | #ifndef NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED |
| 10 | #define NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 11 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 12 | #include <ndnboost/mpl/aux_/lambda_support.hpp> |
| 13 | #include <ndnboost/config.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | // these are needed regardless of NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC |
| 16 | #if defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 17 | namespace ndnboost { 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; }; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 22 | typedef int invoke_NDNBOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces; |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 23 | }} |
| 24 | #endif |
| 25 | |
| 26 | // agurt, 27/jun/03: disable the workaround if user defined |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 27 | // NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC |
| 28 | #if !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
| 29 | || defined(NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 31 | # define NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) /**/ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 32 | |
| 33 | #else |
| 34 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 35 | // same as NDNBOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 macro, except that it |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 36 | // never gets #undef-ined |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 37 | # define NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(trait,spec,result) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 38 | template<> struct trait##_impl<spec> \ |
| 39 | { \ |
| 40 | typedef result type; \ |
| 41 | }; \ |
| 42 | /**/ |
| 43 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 44 | # define NDNBOOST_TT_AUX_REMOVE_CONST_VOLATILE_RANK1_SPEC(T) \ |
| 45 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_const,T const,T) \ |
| 46 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_const,T const volatile,T volatile) \ |
| 47 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T volatile,T) \ |
| 48 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_volatile,T const volatile,T const) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 49 | /**/ |
| 50 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 51 | # define NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T) \ |
| 52 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*,T) \ |
| 53 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*const,T) \ |
| 54 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*volatile,T) \ |
| 55 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_pointer,T*const volatile,T) \ |
| 56 | NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(remove_reference,T&,T) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 57 | /**/ |
| 58 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 59 | # define NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_2_SPEC(T) \ |
| 60 | NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T) \ |
| 61 | NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T const) \ |
| 62 | NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T volatile) \ |
| 63 | NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_1_SPEC(T const volatile) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 64 | /**/ |
| 65 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 66 | # define NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T) \ |
| 67 | NDNBOOST_TT_AUX_REMOVE_PTR_REF_RANK_2_SPEC(T) \ |
| 68 | NDNBOOST_TT_AUX_REMOVE_CONST_VOLATILE_RANK1_SPEC(T) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 69 | /**/ |
| 70 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 71 | # define NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T) \ |
| 72 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T*) \ |
| 73 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T const*) \ |
| 74 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T volatile*) \ |
| 75 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T const volatile*) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 76 | /**/ |
| 77 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 78 | # define NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 79 | namespace ndnboost { namespace detail { \ |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 80 | typedef invoke_NDNBOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces \ |
| 81 | please_invoke_NDNBOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces; \ |
| 82 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_1_SPEC(T) \ |
| 83 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T) \ |
| 84 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T*) \ |
| 85 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const*) \ |
| 86 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T volatile*) \ |
| 87 | NDNBOOST_TT_AUX_REMOVE_ALL_RANK_2_SPEC(T const volatile*) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 88 | }} \ |
| 89 | /**/ |
| 90 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 91 | # include <ndnboost/type_traits/detail/type_trait_undef.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 92 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 93 | #endif // NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 94 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 95 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(bool) |
| 96 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(char) |
| 97 | #ifndef NDNBOOST_NO_INTRINSIC_WCHAR_T |
| 98 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(wchar_t) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 99 | #endif |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 100 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed char) |
| 101 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned char) |
| 102 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed short) |
| 103 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned short) |
| 104 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed int) |
| 105 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned int) |
| 106 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed long) |
| 107 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned long) |
| 108 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(float) |
| 109 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(double) |
| 110 | //NDNBOOST_TT_BROKEN_COMPILER_SPEC(long double) |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 111 | |
| 112 | // for backward compatibility |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 113 | #define NDNBOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \ |
| 114 | NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) \ |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 115 | /**/ |
| 116 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 117 | #endif // NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED |