fix doc example typo
[boost.git] / boost / type_traits / is_member_function_pointer.hpp
blob3fff063326b26a57ea6b51a9e55da1a1613b3171
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.
11 #ifndef BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
12 #define BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
14 #include <boost/type_traits/config.hpp>
15 #include <boost/detail/workaround.hpp>
17 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
18 && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
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.
24 # include <boost/type_traits/detail/is_mem_fun_pointer_impl.hpp>
25 # include <boost/type_traits/remove_cv.hpp>
26 #else
27 # include <boost/type_traits/is_reference.hpp>
28 # include <boost/type_traits/is_array.hpp>
29 # include <boost/type_traits/detail/yes_no_type.hpp>
30 # include <boost/type_traits/detail/false_result.hpp>
31 # include <boost/type_traits/detail/ice_or.hpp>
32 # include <boost/type_traits/detail/is_mem_fun_pointer_tester.hpp>
33 #endif
35 // should be the last #include
36 #include <boost/type_traits/detail/bool_trait_def.hpp>
38 namespace boost {
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)
44 BOOST_TT_AUX_BOOL_TRAIT_DEF1(
45 is_member_function_pointer
46 , T
47 , ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value
50 #else
52 namespace detail {
54 #ifndef __BORLANDC__
56 template <bool>
57 struct is_mem_fun_pointer_select
58 : ::boost::type_traits::false_result
62 template <>
63 struct is_mem_fun_pointer_select<false>
65 template <typename T> struct result_
67 #if BOOST_WORKAROUND(_MSC_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;
74 BOOST_STATIC_CONSTANT(
75 bool, value = (
76 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t))
77 ));
78 #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000)
79 #pragma warning(pop)
80 #endif
84 template <typename T>
85 struct is_member_function_pointer_impl
86 : is_mem_fun_pointer_select<
87 ::boost::type_traits::ice_or<
88 ::boost::is_reference<T>::value
89 , ::boost::is_array<T>::value
90 >::value
91 >::template result_<T>
95 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
96 template <typename T>
97 struct is_member_function_pointer_impl<T&> : public false_type{};
98 #endif
100 #else // Borland C++
102 template <typename T>
103 struct is_member_function_pointer_impl
105 static T* m_t;
106 BOOST_STATIC_CONSTANT(
107 bool, value =
108 (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) );
111 template <typename T>
112 struct is_member_function_pointer_impl<T&>
114 BOOST_STATIC_CONSTANT(bool, value = false);
117 #endif
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
126 } // namespace detail
128 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_member_function_pointer_impl<T>::value)
130 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
132 } // namespace boost
134 #include <boost/type_traits/detail/bool_trait_undef.hpp>
136 #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED