blob: 00a5ee02d901a2924588933d580f8578c30262a0 [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
Jeff Thompson3d613fd2013-10-15 15:39:04 -07009#ifndef NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED
10#define NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED
Jeff Thompsonf7d49942013-08-01 16:47:40 -070011
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015// these are needed regardless of NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC
16#if defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070017namespace 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; };
Jeff Thompson3d613fd2013-10-15 15:39:04 -070022typedef int invoke_NDNBOOST_TT_BROKEN_COMPILER_SPEC_outside_all_namespaces;
Jeff Thompsonf7d49942013-08-01 16:47:40 -070023}}
24#endif
25
26// agurt, 27/jun/03: disable the workaround if user defined
Jeff Thompson3d613fd2013-10-15 15:39:04 -070027// NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC
28#if !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
29 || defined(NDNBOOST_TT_NO_BROKEN_COMPILER_SPEC)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070030
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031# define NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) /**/
Jeff Thompsonf7d49942013-08-01 16:47:40 -070032
33#else
34
Jeff Thompson3d613fd2013-10-15 15:39:04 -070035// same as NDNBOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 macro, except that it
Jeff Thompsonf7d49942013-08-01 16:47:40 -070036// never gets #undef-ined
Jeff Thompson3d613fd2013-10-15 15:39:04 -070037# define NDNBOOST_TT_AUX_BROKEN_TYPE_TRAIT_SPEC1(trait,spec,result) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070038template<> struct trait##_impl<spec> \
39{ \
40 typedef result type; \
41}; \
42/**/
43
Jeff Thompson3d613fd2013-10-15 15:39:04 -070044# 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 Thompsonf7d49942013-08-01 16:47:40 -070049 /**/
50
Jeff Thompson3d613fd2013-10-15 15:39:04 -070051# 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 Thompsonf7d49942013-08-01 16:47:40 -070057 /**/
58
Jeff Thompson3d613fd2013-10-15 15:39:04 -070059# 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 Thompsonf7d49942013-08-01 16:47:40 -070064 /**/
65
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066# 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 Thompsonf7d49942013-08-01 16:47:40 -070069 /**/
70
Jeff Thompson3d613fd2013-10-15 15:39:04 -070071# 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 Thompsonf7d49942013-08-01 16:47:40 -070076 /**/
77
Jeff Thompson3d613fd2013-10-15 15:39:04 -070078# define NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -070079 namespace ndnboost { namespace detail { \
Jeff Thompson3d613fd2013-10-15 15:39:04 -070080 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 Thompsonf7d49942013-08-01 16:47:40 -070088 }} \
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070093#endif // NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Jeff Thompsonf7d49942013-08-01 16:47:40 -070094
Jeff Thompson3d613fd2013-10-15 15:39:04 -070095NDNBOOST_TT_BROKEN_COMPILER_SPEC(bool)
96NDNBOOST_TT_BROKEN_COMPILER_SPEC(char)
97#ifndef NDNBOOST_NO_INTRINSIC_WCHAR_T
98NDNBOOST_TT_BROKEN_COMPILER_SPEC(wchar_t)
Jeff Thompsonf7d49942013-08-01 16:47:40 -070099#endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700100NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed char)
101NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned char)
102NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed short)
103NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned short)
104NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed int)
105NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned int)
106NDNBOOST_TT_BROKEN_COMPILER_SPEC(signed long)
107NDNBOOST_TT_BROKEN_COMPILER_SPEC(unsigned long)
108NDNBOOST_TT_BROKEN_COMPILER_SPEC(float)
109NDNBOOST_TT_BROKEN_COMPILER_SPEC(double)
110//NDNBOOST_TT_BROKEN_COMPILER_SPEC(long double)
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700111
112// for backward compatibility
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700113#define NDNBOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(T) \
114 NDNBOOST_TT_BROKEN_COMPILER_SPEC(T) \
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700115/**/
116
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700117#endif // NDNBOOST_TT_BROKEN_COMPILER_SPEC_HPP_INCLUDED