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 |
|
---|
14 | #include "boost/type_traits/config.hpp"
|
---|
15 | #include "boost/detail/workaround.hpp"
|
---|
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 | //
|
---|
24 | # include "boost/type_traits/detail/is_mem_fun_pointer_impl.hpp"
|
---|
25 | #else
|
---|
26 | # include "boost/type_traits/is_reference.hpp"
|
---|
27 | # include "boost/type_traits/is_array.hpp"
|
---|
28 | # include "boost/type_traits/detail/yes_no_type.hpp"
|
---|
29 | # include "boost/type_traits/detail/false_result.hpp"
|
---|
30 | # include "boost/type_traits/detail/ice_or.hpp"
|
---|
31 | # include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp"
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | // should be the last #include
|
---|
35 | #include "boost/type_traits/detail/bool_trait_def.hpp"
|
---|
36 |
|
---|
37 | namespace boost {
|
---|
38 |
|
---|
39 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
|
---|
40 |
|
---|
41 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
---|
42 | is_member_function_pointer
|
---|
43 | , T
|
---|
44 | , ::boost::type_traits::is_mem_fun_pointer_impl<T>::value
|
---|
45 | )
|
---|
46 |
|
---|
47 | #else
|
---|
48 |
|
---|
49 | namespace detail {
|
---|
50 |
|
---|
51 | #ifndef __BORLANDC__
|
---|
52 |
|
---|
53 | template <bool>
|
---|
54 | struct is_mem_fun_pointer_select
|
---|
55 | : ::boost::type_traits::false_result
|
---|
56 | {
|
---|
57 | };
|
---|
58 |
|
---|
59 | template <>
|
---|
60 | struct is_mem_fun_pointer_select<false>
|
---|
61 | {
|
---|
62 | template <typename T> struct result_
|
---|
63 | {
|
---|
64 | static T* make_t;
|
---|
65 | typedef result_<T> self_type;
|
---|
66 |
|
---|
67 | BOOST_STATIC_CONSTANT(
|
---|
68 | bool, value = (
|
---|
69 | 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t))
|
---|
70 | ));
|
---|
71 | };
|
---|
72 | };
|
---|
73 |
|
---|
74 | template <typename T>
|
---|
75 | struct is_member_function_pointer_impl
|
---|
76 | : is_mem_fun_pointer_select<
|
---|
77 | ::boost::type_traits::ice_or<
|
---|
78 | ::boost::is_reference<T>::value
|
---|
79 | , ::boost::is_array<T>::value
|
---|
80 | >::value
|
---|
81 | >::template result_<T>
|
---|
82 | {
|
---|
83 | };
|
---|
84 |
|
---|
85 | #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
---|
86 | template <typename T>
|
---|
87 | struct is_member_function_pointer_impl<T&> : public false_type{};
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #else // Borland C++
|
---|
91 |
|
---|
92 | template <typename T>
|
---|
93 | struct is_member_function_pointer_impl
|
---|
94 | {
|
---|
95 | static T* m_t;
|
---|
96 | BOOST_STATIC_CONSTANT(
|
---|
97 | bool, value =
|
---|
98 | (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) );
|
---|
99 | };
|
---|
100 |
|
---|
101 | template <typename T>
|
---|
102 | struct is_member_function_pointer_impl<T&>
|
---|
103 | {
|
---|
104 | BOOST_STATIC_CONSTANT(bool, value = false);
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void,false)
|
---|
110 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
---|
111 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const,false)
|
---|
112 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void volatile,false)
|
---|
113 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const volatile,false)
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | } // namespace detail
|
---|
117 |
|
---|
118 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_function_pointer,T,::boost::detail::is_member_function_pointer_impl<T>::value)
|
---|
119 |
|
---|
120 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
---|
121 |
|
---|
122 | } // namespace boost
|
---|
123 |
|
---|
124 | #include "boost/type_traits/detail/bool_trait_undef.hpp"
|
---|
125 |
|
---|
126 | #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
|
---|