]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_member_pointer.hpp
update to boost 1.30.1
[lyx.git] / boost / boost / type_traits / is_member_pointer.hpp
1
2 // (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard
3 // Hinnant & John Maddock 2000.  Permission to copy, use, modify,
4 // sell and distribute this software is granted provided this
5 // copyright notice appears in all copies. This software is provided
6 // "as is" without express or implied warranty, and with no claim as
7 // to its suitability for any purpose.
8 //
9 // See http://www.boost.org for most recent version including documentation.
10
11 #ifndef BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED
12 #define BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED
13
14 #include "boost/type_traits/config.hpp"
15
16 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__)
17 #   include "boost/type_traits/is_member_function_pointer.hpp"
18 #else
19 #   include "boost/type_traits/is_reference.hpp"
20 #   include "boost/type_traits/is_array.hpp"
21 #   include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp"
22 #   include "boost/type_traits/detail/yes_no_type.hpp"
23 #   include "boost/type_traits/detail/false_result.hpp"
24 #   include "boost/type_traits/detail/ice_or.hpp"
25 #endif
26
27 // should be the last #include
28 #include "boost/type_traits/detail/bool_trait_def.hpp"
29
30 namespace boost {
31
32 #if defined(__BORLANDC__)
33 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,false)
34 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true)
35
36 #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
37 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::is_member_function_pointer<T>::value)
38 BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true)
39
40 #else // no partial template specialization
41
42 namespace detail {
43
44 template <typename R, typename T>
45 ::boost::type_traits::yes_type BOOST_TT_DECL is_member_pointer_tester(R T::*);
46 ::boost::type_traits::no_type BOOST_TT_DECL is_member_pointer_tester(...);
47
48 template <bool>
49 struct is_member_pointer_select
50     : ::boost::type_traits::false_result
51 {
52 };
53
54 template <>
55 struct is_member_pointer_select<false>
56 {
57     template <typename T> struct result_
58     {
59         static T& make_t();
60         BOOST_STATIC_CONSTANT(
61             bool, value = 
62             (::boost::type_traits::ice_or<
63                 (1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(make_t()))),
64                 (1 == sizeof(is_member_pointer_tester(make_t())))
65             >::value) );
66     };
67 };
68
69 template <typename T>
70 struct is_member_pointer_impl
71     : is_member_pointer_select<
72           ::boost::type_traits::ice_or<
73               ::boost::is_reference<T>::value
74             , ::boost::is_array<T>::value
75             >::value
76         >::template result_<T>
77 {
78 };
79
80 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void,false)
81 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
82 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const,false)
83 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void volatile,false)
84 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const volatile,false)
85 #endif
86
87 } // namespace detail
88
89 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::detail::is_member_pointer_impl<T>::value)
90
91 #endif // __BORLANDC__
92
93 } // namespace boost
94
95 #include "boost/type_traits/detail/bool_trait_undef.hpp"
96
97 #endif // BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED