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 | |
| 9 | #ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED |
| 10 | #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED |
| 11 | |
| 12 | #include <ndnboost/config.hpp> |
| 13 | #include <ndnboost/detail/workaround.hpp> |
| 14 | #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
| 15 | #include <ndnboost/type_traits/broken_compiler_spec.hpp> |
| 16 | #endif |
| 17 | |
| 18 | #if BOOST_WORKAROUND(BOOST_MSVC,<=1300) |
| 19 | #include <ndnboost/type_traits/msvc/remove_pointer.hpp> |
| 20 | #elif defined(BOOST_MSVC) |
| 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 | |
| 30 | #ifdef BOOST_MSVC |
| 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 | |
| 72 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename ndnboost::detail::remove_pointer_imp2<T>::type) |
| 73 | |
| 74 | #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
| 75 | |
| 76 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) |
| 77 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T) |
| 78 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const,T) |
| 79 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* volatile,T) |
| 80 | BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T* const volatile,T) |
| 81 | |
| 82 | #elif !BOOST_WORKAROUND(BOOST_MSVC,<=1300) |
| 83 | |
| 84 | BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename ndnboost::detail::remove_pointer_impl<T>::type) |
| 85 | |
| 86 | #endif |
| 87 | |
| 88 | } // namespace ndnboost |
| 89 | |
| 90 | #include <ndnboost/type_traits/detail/type_trait_undef.hpp> |
| 91 | |
| 92 | #endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED |