blob: 63115b9328e6daf4f28b811f4170167854e70245 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001
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 Thompson2277ce52013-08-01 17:34:11 -070014#include <ndnboost/type_traits/config.hpp>
15#include <ndnboost/detail/workaround.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070016
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 Thompson2277ce52013-08-01 17:34:11 -070024# include <ndnboost/type_traits/detail/is_mem_fun_pointer_impl.hpp>
25# include <ndnboost/type_traits/remove_cv.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070026#else
Jeff Thompson2277ce52013-08-01 17:34:11 -070027# 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 Thompsonf7d49942013-08-01 16:47:40 -070033#endif
34
35// should be the last #include
Jeff Thompson2277ce52013-08-01 17:34:11 -070036#include <ndnboost/type_traits/detail/bool_trait_def.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -070037
38namespace ndnboost {
39
40#if defined( __CODEGEARC__ )
41BOOST_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
44BOOST_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
52namespace detail {
53
54#ifndef __BORLANDC__
55
56template <bool>
57struct is_mem_fun_pointer_select
58 : public ::ndnboost::type_traits::false_result
59{
60};
61
62template <>
63struct 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
84template <typename T>
85struct 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
96template <typename T>
97struct is_member_function_pointer_impl<T&> : public false_type{};
98#endif
99
100#else // Borland C++
101
102template <typename T>
103struct 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
111template <typename T>
112struct is_member_function_pointer_impl<T&>
113{
114 BOOST_STATIC_CONSTANT(bool, value = false);
115};
116
117#endif
118
119BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void,false)
120#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
121BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const,false)
122BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void volatile,false)
123BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_function_pointer,void const volatile,false)
124#endif
125
126} // namespace detail
127
128BOOST_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 Thompson2277ce52013-08-01 17:34:11 -0700134#include <ndnboost/type_traits/detail/bool_trait_undef.hpp>
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700135
136#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED