]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/detail/config.hpp> | |
15 | #include <boost/detail/workaround.hpp> | |
16 | ||
17 | #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) | |
18 | // | |
19 | // Note: we use the "workaround" version for MSVC because it works for | |
20 | // __stdcall etc function types, where as the partial specialisation | |
21 | // version does not do so. | |
22 | // | |
23 | # include <boost/type_traits/detail/is_mem_fun_pointer_impl.hpp> | |
24 | # include <boost/type_traits/remove_cv.hpp> | |
25 | # include <boost/type_traits/integral_constant.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/is_mem_fun_pointer_tester.hpp> | |
31 | #endif | |
32 | ||
33 | namespace boost { | |
34 | ||
35 | #if defined( __CODEGEARC__ ) | |
36 | template <class T> struct is_member_function_pointer : public integral_constant<bool, __is_member_function_pointer( T )> {}; | |
37 | #elif !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) | |
38 | ||
39 | template <class T> struct is_member_function_pointer | |
40 | : public ::boost::integral_constant<bool, ::boost::type_traits::is_mem_fun_pointer_impl<typename remove_cv<T>::type>::value>{}; | |
41 | ||
42 | #else | |
43 | ||
44 | namespace detail { | |
45 | ||
46 | #ifndef __BORLANDC__ | |
47 | ||
48 | template <bool> | |
49 | struct is_mem_fun_pointer_select | |
50 | { | |
51 | template <class T> struct result_ : public false_type{}; | |
52 | }; | |
53 | ||
54 | template <> | |
55 | struct is_mem_fun_pointer_select<false> | |
56 | { | |
57 | template <typename T> struct result_ | |
58 | { | |
59 | #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) | |
60 | #pragma warning(push) | |
61 | #pragma warning(disable:6334) | |
62 | #endif | |
63 | static T* make_t; | |
64 | typedef result_<T> self_type; | |
65 | ||
66 | BOOST_STATIC_CONSTANT( | |
67 | bool, value = ( | |
68 | 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) | |
69 | )); | |
70 | #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) | |
71 | #pragma warning(pop) | |
72 | #endif | |
73 | }; | |
74 | }; | |
75 | ||
76 | template <typename T> | |
77 | struct is_member_function_pointer_impl | |
78 | : public is_mem_fun_pointer_select< | |
79 | ::boost::is_reference<T>::value || ::boost::is_array<T>::value>::template result_<T>{}; | |
80 | ||
81 | template <typename T> | |
82 | struct is_member_function_pointer_impl<T&> : public false_type{}; | |
83 | ||
84 | #else // Borland C++ | |
85 | ||
86 | template <typename T> | |
87 | struct is_member_function_pointer_impl | |
88 | { | |
89 | static T* m_t; | |
90 | BOOST_STATIC_CONSTANT( | |
91 | bool, value = | |
92 | (1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) ); | |
93 | }; | |
94 | ||
95 | template <typename T> | |
96 | struct is_member_function_pointer_impl<T&> | |
97 | { | |
98 | BOOST_STATIC_CONSTANT(bool, value = false); | |
99 | }; | |
100 | ||
101 | #endif | |
102 | ||
103 | template<> struct is_member_function_pointer_impl<void> : public false_type{}; | |
104 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS | |
105 | template<> struct is_member_function_pointer_impl<void const> : public false_type{}; | |
106 | template<> struct is_member_function_pointer_impl<void const volatile> : public false_type{}; | |
107 | template<> struct is_member_function_pointer_impl<void volatile> : public false_type{}; | |
108 | #endif | |
109 | ||
110 | } // namespace detail | |
111 | ||
112 | template <class T> | |
113 | struct is_member_function_pointer | |
114 | : public integral_constant<bool, ::boost::detail::is_member_function_pointer_impl<T>::value>{}; | |
115 | ||
116 | #endif | |
117 | ||
118 | } // namespace boost | |
119 | ||
120 | #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED |