1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef INDIRECT_TRAITS_DWA2002131_HPP
6 # define INDIRECT_TRAITS_DWA2002131_HPP
7 # include <boost/type_traits/is_function.hpp>
8 # include <boost/type_traits/is_reference.hpp>
9 # include <boost/type_traits/is_pointer.hpp>
10 # include <boost/type_traits/is_class.hpp>
11 # include <boost/type_traits/is_const.hpp>
12 # include <boost/type_traits/is_volatile.hpp>
13 # include <boost/type_traits/is_member_function_pointer.hpp>
14 # include <boost/type_traits/is_member_pointer.hpp>
15 # include <boost/type_traits/remove_cv.hpp>
16 # include <boost/type_traits/remove_reference.hpp>
17 # include <boost/type_traits/remove_pointer.hpp>
19 # include <boost/detail/workaround.hpp>
21 # include <boost/mpl/eval_if.hpp>
22 # include <boost/mpl/if.hpp>
23 # include <boost/mpl/bool.hpp>
24 # include <boost/mpl/and.hpp>
25 # include <boost/mpl/not.hpp>
26 # include <boost/mpl/aux_/lambda_support.hpp>
29 namespace boost { namespace detail {
31 namespace indirect_traits {
34 struct is_reference_to_const : mpl::false_
39 struct is_reference_to_const<T const&> : mpl::true_
43 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
45 struct is_reference_to_const<T const volatile&> : mpl::true_
51 struct is_reference_to_function : mpl::false_
56 struct is_reference_to_function<T&> : is_function<T>
61 struct is_pointer_to_function : mpl::false_
65 // There's no such thing as a pointer-to-cv-function, so we don't need
66 // specializations for those
68 struct is_pointer_to_function<T*> : is_function<T>
73 struct is_reference_to_member_function_pointer_impl : mpl::false_
78 struct is_reference_to_member_function_pointer_impl<T&>
79 : is_member_function_pointer<typename remove_cv<T>::type>
85 struct is_reference_to_member_function_pointer
86 : is_reference_to_member_function_pointer_impl<T>
88 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
92 struct is_reference_to_function_pointer_aux
95 , is_pointer_to_function<
97 typename remove_reference<T>::type
102 // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
106 struct is_reference_to_function_pointer
108 is_reference_to_function<T>
110 , is_reference_to_function_pointer_aux<T>
116 struct is_reference_to_non_const
120 is_reference_to_const<T>
127 struct is_reference_to_volatile : mpl::false_
132 struct is_reference_to_volatile<T volatile&> : mpl::true_
136 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
138 struct is_reference_to_volatile<T const volatile&> : mpl::true_
145 struct is_reference_to_pointer : mpl::false_
150 struct is_reference_to_pointer<T*&> : mpl::true_
155 struct is_reference_to_pointer<T* const&> : mpl::true_
160 struct is_reference_to_pointer<T* volatile&> : mpl::true_
165 struct is_reference_to_pointer<T* const volatile&> : mpl::true_
170 struct is_reference_to_class
175 typename remove_reference<T>::type
180 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
184 struct is_pointer_to_class
189 typename remove_pointer<T>::type
194 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
200 using namespace indirect_traits;
202 }} // namespace boost::python::detail
204 #endif // INDIRECT_TRAITS_DWA2002131_HPP