Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 1 | |
| 2 | // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard |
| 3 | // Hinnant & John Maddock 2000. |
| 4 | // Use, modification and distribution are subject to the Boost Software License, |
| 5 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt). |
| 7 | // |
| 8 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
| 9 | |
| 10 | |
| 11 | #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED |
| 12 | #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED |
| 13 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 14 | #include <ndnboost/type_traits/config.hpp> |
| 15 | #include <ndnboost/detail/workaround.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 16 | |
| 17 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
| 18 | && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) |
| 19 | // |
| 20 | // Note: we use the "workaround" version for MSVC because it works for |
| 21 | // __stdcall etc function types, where as the partial specialisation |
| 22 | // version does not do so. |
| 23 | // |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 24 | # include <ndnboost/type_traits/detail/is_mem_fun_pointer_impl.hpp> |
| 25 | # include <ndnboost/type_traits/remove_cv.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 26 | #else |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 27 | # include <ndnboost/type_traits/is_reference.hpp> |
| 28 | # include <ndnboost/type_traits/is_array.hpp> |
| 29 | # include <ndnboost/type_traits/detail/yes_no_type.hpp> |
| 30 | # include <ndnboost/type_traits/detail/false_result.hpp> |
| 31 | # include <ndnboost/type_traits/detail/ice_or.hpp> |
| 32 | # include <ndnboost/type_traits/detail/is_mem_fun_pointer_tester.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 33 | #endif |
| 34 | |
| 35 | // should be the last #include |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 36 | #include <ndnboost/type_traits/detail/bool_trait_def.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 37 | |
| 38 | namespace ndnboost { |
| 39 | |
| 40 | #if defined( __CODEGEARC__ ) |
| 41 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,__is_member_function_pointer( T )) |
| 42 | #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) |
| 43 | |
| 44 | BOOST_TT_AUX_BOOL_TRAIT_DEF1( |
| 45 | is_member_function_pointer |
| 46 | , T |
| 47 | , ::ndnboost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value |
| 48 | ) |
| 49 | |
| 50 | #else |
| 51 | |
| 52 | namespace detail { |
| 53 | |
| 54 | #ifndef __BORLANDC__ |
| 55 | |
| 56 | template <bool> |
| 57 | struct is_mem_fun_pointer_select |
| 58 | : public ::ndnboost::type_traits::false_result |
| 59 | { |
| 60 | }; |
| 61 | |
| 62 | template <> |
| 63 | struct is_mem_fun_pointer_select<false> |
| 64 | { |
| 65 | template <typename T> struct result_ |
| 66 | { |
| 67 | #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) |
| 68 | #pragma warning(push) |
| 69 | #pragma warning(disable:6334) |
| 70 | #endif |
| 71 | static T* make_t; |
| 72 | typedef result_<T> self_type; |
| 73 | |
| 74 | BOOST_STATIC_CONSTANT( |
| 75 | bool, value = ( |
| 76 | 1 == sizeof(::ndnboost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) |
| 77 | )); |
| 78 | #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) |
| 79 | #pragma warning(pop) |
| 80 | #endif |
| 81 | }; |
| 82 | }; |
| 83 | |
| 84 | template <typename T> |
| 85 | struct is_member_function_pointer_impl |
| 86 | : public is_mem_fun_pointer_select< |
| 87 | ::ndnboost::type_traits::ice_or< |
| 88 | ::ndnboost::is_reference<T>::value |
| 89 | , ::ndnboost::is_array<T>::value |
| 90 | >::value |
| 91 | >::template result_<T> |
| 92 | { |
| 93 | }; |
| 94 | |
| 95 | #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
| 96 | template <typename T> |
| 97 | struct is_member_function_pointer_impl<T&> : public false_type{}; |
| 98 | #endif |
| 99 | |
| 100 | #else // Borland C++ |
| 101 | |
| 102 | template <typename T> |
| 103 | struct is_member_function_pointer_impl |
| 104 | { |
| 105 | static T* m_t; |
| 106 | BOOST_STATIC_CONSTANT( |
| 107 | bool, value = |
| 108 | (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) ); |
| 109 | }; |
| 110 | |
| 111 | template <typename T> |
| 112 | struct is_member_function_pointer_impl<T&> |
| 113 | { |
| 114 | BOOST_STATIC_CONSTANT(bool, value = false); |
| 115 | }; |
| 116 | |
| 117 | #endif |
| 118 | |
| 119 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void,false) |
| 120 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS |
| 121 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const,false) |
| 122 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void volatile,false) |
| 123 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const volatile,false) |
| 124 | #endif |
| 125 | |
| 126 | } // namespace detail |
| 127 | |
| 128 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::ndnboost::detail::is_member_function_pointer_impl<T>::value) |
| 129 | |
| 130 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
| 131 | |
| 132 | } // namespace ndnboost |
| 133 | |
Jeff Thompson | 2277ce5 | 2013-08-01 17:34:11 -0700 | [diff] [blame] | 134 | #include <ndnboost/type_traits/detail/bool_trait_undef.hpp> |
Jeff Thompson | f7d4994 | 2013-08-01 16:47:40 -0700 | [diff] [blame] | 135 | |
| 136 | #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED |