blob: 7e5023d2e0cb75f51eda853b166f78478f8351ff [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001
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
Jeff Thompson2277ce52013-08-01 17:34:11 -070012#include <ndnboost/mpl/aux_/lambda_support.hpp>
13#include <ndnboost/config.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070014
15// these are needed regardless of BOOST_TT_NO_BROKEN_COMPILER_SPEC
16#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
17namespace ndnboost { namespace detail {
18template< typename T > struct remove_const_impl { typedef T type; };
19template< typename T > struct remove_volatile_impl { typedef T type; };
20template< typename T > struct remove_pointer_impl { typedef T type; };
21template< typename T > struct remove_reference_impl { typedef T type; };
22typedef 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) \
38template<> 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 ndnboost { 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
Jeff Thompson2277ce52013-08-01 17:34:11 -070091# include <ndnboost/type_traits/detail/type_trait_undef.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070092
93#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
94
95BOOST_TT_BROKEN_COMPILER_SPEC(bool)
96BOOST_TT_BROKEN_COMPILER_SPEC(char)
97#ifndef BOOST_NO_INTRINSIC_WCHAR_T
98BOOST_TT_BROKEN_COMPILER_SPEC(wchar_t)
99#endif
100BOOST_TT_BROKEN_COMPILER_SPEC(signed char)
101BOOST_TT_BROKEN_COMPILER_SPEC(unsigned char)
102BOOST_TT_BROKEN_COMPILER_SPEC(signed short)
103BOOST_TT_BROKEN_COMPILER_SPEC(unsigned short)
104BOOST_TT_BROKEN_COMPILER_SPEC(signed int)
105BOOST_TT_BROKEN_COMPILER_SPEC(unsigned int)
106BOOST_TT_BROKEN_COMPILER_SPEC(signed long)
107BOOST_TT_BROKEN_COMPILER_SPEC(unsigned long)
108BOOST_TT_BROKEN_COMPILER_SPEC(float)
109BOOST_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