is_member_function_pointer_cxx_03.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
  2. // 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. #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_03_HPP_INCLUDED
  9. #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_CXX_03_HPP_INCLUDED
  10. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
  11. //
  12. // Note: we use the "workaround" version for MSVC because it works for
  13. // __stdcall etc function types, where as the partial specialisation
  14. // version does not do so.
  15. //
  16. # include <boost/type_traits/detail/is_mem_fun_pointer_impl.hpp>
  17. # include <boost/type_traits/remove_cv.hpp>
  18. # include <boost/type_traits/integral_constant.hpp>
  19. #else
  20. # include <boost/type_traits/is_reference.hpp>
  21. # include <boost/type_traits/is_array.hpp>
  22. # include <boost/type_traits/detail/yes_no_type.hpp>
  23. # include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp>
  24. #endif
  25. namespace boost {
  26. #if defined( __CODEGEARC__ )
  27. template <class T> struct is_member_function_pointer : public integral_constant<bool, __is_member_function_pointer( T )> {};
  28. #elif !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
  29. template <class T> struct is_member_function_pointer
  30. : public ::boost::integral_constant<bool, ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value>{};
  31. #else
  32. namespace detail {
  33. #ifndef __BORLANDC__
  34. template <bool>
  35. struct is_mem_fun_pointer_select
  36. {
  37. template <class T> struct result_ : public false_type{};
  38. };
  39. template <>
  40. struct is_mem_fun_pointer_select<false>
  41. {
  42. template <typename T> struct result_
  43. {
  44. #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
  45. #pragma warning(push)
  46. #pragma warning(disable:6334)
  47. #endif
  48. static T* make_t;
  49. typedef result_<T> self_type;
  50. BOOST_STATIC_CONSTANT(
  51. bool, value = (
  52. 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t))
  53. ));
  54. #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
  55. #pragma warning(pop)
  56. #endif
  57. };
  58. };
  59. template <typename T>
  60. struct is_member_function_pointer_impl
  61. : public is_mem_fun_pointer_select<
  62. ::boost::is_reference<T>::value || ::boost::is_array<T>::value>::template result_<T>{};
  63. template <typename T>
  64. struct is_member_function_pointer_impl<T&> : public false_type{};
  65. #else // Borland C++
  66. template <typename T>
  67. struct is_member_function_pointer_impl
  68. {
  69. static T* m_t;
  70. BOOST_STATIC_CONSTANT(
  71. bool, value =
  72. (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) );
  73. };
  74. template <typename T>
  75. struct is_member_function_pointer_impl<T&>
  76. {
  77. BOOST_STATIC_CONSTANT(bool, value = false);
  78. };
  79. #endif
  80. template<> struct is_member_function_pointer_impl<void> : public false_type{};
  81. #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
  82. template<> struct is_member_function_pointer_impl<void const> : public false_type{};
  83. template<> struct is_member_function_pointer_impl<void const volatile> : public false_type{};
  84. template<> struct is_member_function_pointer_impl<void volatile> : public false_type{};
  85. #endif
  86. } // namespace detail
  87. template <class T>
  88. struct is_member_function_pointer
  89. : public integral_constant<bool, ::boost::detail::is_member_function_pointer_impl<T>::value>{};
  90. #endif
  91. } // namespace boost
  92. #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED