fixing stuff
[dyninst.git] / dynutil / h / dyn_detail / boost / type_traits / is_member_pointer.hpp
1
2 //  (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, 
3 //      Howard Hinnant and John Maddock 2000. 
4 //  (C) Copyright Mat Marcus, Jesse Jones and Adobe Systems Inc 2001
5
6 //  Use, modification and distribution are subject to the Boost Software License,
7 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 //  http://www.boost.org/LICENSE_1_0.txt).
9 //
10 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
11
12 //    Fixed is_pointer, is_reference, is_const, is_volatile, is_same, 
13 //    is_member_pointer based on the Simulated Partial Specialization work 
14 //    of Mat Marcus and Jesse Jones. See  http://opensource.adobe.com or 
15 //    http://groups.yahoo.com/group/boost/message/5441 
16 //    Some workarounds in here use ideas suggested from "Generic<Programming>: 
17 //    Mappings between Types and Values" 
18 //    by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html).
19
20
21 #ifndef DYN_DETAIL_BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED
22 #define DYN_DETAIL_BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED
23
24 #include <dyn_detail/boost/type_traits/config.hpp>
25 #include <dyn_detail/boost/detail/workaround.hpp>
26
27 #if !defined(DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !DYN_DETAIL_BOOST_WORKAROUND(__BORLANDC__, < 0x600)
28 #   include <dyn_detail/boost/type_traits/is_member_function_pointer.hpp>
29 #else
30 #   include <dyn_detail/boost/type_traits/is_reference.hpp>
31 #   include <dyn_detail/boost/type_traits/is_array.hpp>
32 #   include <dyn_detail/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp>
33 #   include <dyn_detail/boost/type_traits/detail/yes_no_type.hpp>
34 #   include <dyn_detail/boost/type_traits/detail/false_result.hpp>
35 #   include <dyn_detail/boost/type_traits/detail/ice_or.hpp>
36 #endif
37
38 // should be the last #include
39 #include <dyn_detail/boost/type_traits/detail/bool_trait_def.hpp>
40
41 namespace dyn_detail {
42 namespace boost {
43
44 #if defined( __CODEGEARC__ )
45 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,__is_member_pointer(T))
46 #elif DYN_DETAIL_BOOST_WORKAROUND(__BORLANDC__, < 0x600)
47 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,false)
48 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true)
49
50 #elif !defined(DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
51 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::dyn_detail::boost::is_member_function_pointer<T>::value)
52 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true)
53
54 #if !DYN_DETAIL_BOOST_WORKAROUND(__MWERKS__,<=0x3003)
55 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const,true)
56 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*volatile,true)
57 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const volatile,true)
58 #endif
59
60 #else // no partial template specialization
61
62 namespace detail {
63
64 template <typename R, typename T>
65 ::dyn_detail::boost::type_traits::yes_type DYN_DETAIL_BOOST_TT_DECL is_member_pointer_tester(R T::*const volatile*);
66 ::dyn_detail::boost::type_traits::no_type DYN_DETAIL_BOOST_TT_DECL is_member_pointer_tester(...);
67
68 template <bool>
69 struct is_member_pointer_select
70     : ::dyn_detail::boost::type_traits::false_result
71 {
72 };
73
74 template <>
75 struct is_member_pointer_select<false>
76 {
77     template <typename T> struct result_
78     {
79         static T* make_t();
80         DYN_DETAIL_BOOST_STATIC_CONSTANT(
81             bool, value =
82             (::dyn_detail::boost::type_traits::ice_or<
83                 (1 == sizeof(::dyn_detail::boost::type_traits::is_mem_fun_pointer_tester(make_t()))),
84                 (1 == sizeof(is_member_pointer_tester(make_t())))
85             >::value) );
86     };
87 };
88
89 template <typename T>
90 struct is_member_pointer_impl
91     : is_member_pointer_select<
92           ::dyn_detail::boost::type_traits::ice_or<
93               ::dyn_detail::boost::is_reference<T>::value
94             , ::dyn_detail::boost::is_array<T>::value
95             >::value
96         >::template result_<T>
97 {
98 };
99
100 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void,false)
101 #ifndef DYN_DETAIL_BOOST_NO_CV_VOID_SPECIALIZATIONS
102 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const,false)
103 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void volatile,false)
104 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_member_pointer,void const volatile,false)
105 #endif
106
107 } // namespace detail
108
109 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::dyn_detail::boost::detail::is_member_pointer_impl<T>::value)
110
111 #endif // __BORLANDC__
112
113 } // namespace boost
114 } // namespace dyn_detail
115
116 #include <dyn_detail/boost/type_traits/detail/bool_trait_undef.hpp>
117
118 #endif // DYN_DETAIL_BOOST_TT_IS_MEMBER_POINTER_HPP_INCLUDED