Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | |
| 2 | // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. |
| 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_REMOVE_POINTER_HPP_INCLUDED |
| 10 | #define NDNBOOST_TT_REMOVE_POINTER_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 11 | |
| 12 | #include <ndnboost/config.hpp> |
| 13 | #include <ndnboost/detail/workaround.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 14 | #ifdef NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 15 | #include <ndnboost/type_traits/broken_compiler_spec.hpp> |
| 16 | #endif |
| 17 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 18 | #if NDNBOOST_WORKAROUND(NDNBOOST_MSVC,<=1300) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 19 | #include <ndnboost/type_traits/msvc/remove_pointer.hpp> |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 20 | #elif defined(NDNBOOST_MSVC) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 21 | #include <ndnboost/type_traits/remove_cv.hpp> |
| 22 | #include <ndnboost/type_traits/is_pointer.hpp> |
| 23 | #endif |
| 24 | |
| 25 | // should be the last #include |
| 26 | #include <ndnboost/type_traits/detail/type_trait_def.hpp> |
| 27 | |
| 28 | namespace ndnboost { |
| 29 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 30 | #ifdef NDNBOOST_MSVC |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 31 | |
| 32 | namespace detail{ |
| 33 | |
| 34 | // |
| 35 | // We need all this crazy indirection because a type such as: |
| 36 | // |
| 37 | // T (*const)(U) |
| 38 | // |
| 39 | // Does not bind to a <T*> or <T*const> partial specialization with VC10 and earlier |
| 40 | // |
| 41 | template <class T> |
| 42 | struct remove_pointer_imp |
| 43 | { |
| 44 | typedef T type; |
| 45 | }; |
| 46 | |
| 47 | template <class T> |
| 48 | struct remove_pointer_imp<T*> |
| 49 | { |
| 50 | typedef T type; |
| 51 | }; |
| 52 | |
| 53 | template <class T, bool b> |
| 54 | struct remove_pointer_imp3 |
| 55 | { |
| 56 | typedef typename remove_pointer_imp<typename ndnboost::remove_cv<T>::type>::type type; |
| 57 | }; |
| 58 | |
| 59 | template <class T> |
| 60 | struct remove_pointer_imp3<T, false> |
| 61 | { |
| 62 | typedef T type; |
| 63 | }; |
| 64 | |
| 65 | template <class T> |
| 66 | struct remove_pointer_imp2 |
| 67 | { |
| 68 | typedef typename remove_pointer_imp3<T, ::ndnboost::is_pointer<T>::value>::type type; |
| 69 | }; |
| 70 | } |
| 71 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 72 | NDNBOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename ndnboost::detail::remove_pointer_imp2<T>::type) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 73 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 74 | #elif !defined(NDNBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 75 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 76 | NDNBOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) |
| 77 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T) |
| 78 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) |
| 79 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) |
| 80 | NDNBOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 81 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 82 | #elif !NDNBOOST_WORKAROUND(NDNBOOST_MSVC,<=1300) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 83 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 84 | NDNBOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename ndnboost::detail::remove_pointer_impl<T>::type) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 85 | |
| 86 | #endif |
| 87 | |
| 88 | } // namespace ndnboost |
| 89 | |
| 90 | #include <ndnboost/type_traits/detail/type_trait_undef.hpp> |
| 91 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 92 | #endif // NDNBOOST_TT_REMOVE_POINTER_HPP_INCLUDED |