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/type_traits/detail/ice_and.hpp>
20 # include <boost/detail/workaround.hpp>
22 # include <boost/mpl/eval_if.hpp>
23 # include <boost/mpl/if.hpp>
24 # include <boost/mpl/bool.hpp>
25 # include <boost/mpl/and.hpp>
26 # include <boost/mpl/not.hpp>
27 # include <boost/mpl/aux_/lambda_support.hpp>
30 namespace boost { namespace detail {
32 namespace indirect_traits {
35 struct is_reference_to_const : mpl::false_
40 struct is_reference_to_const<T const&> : mpl::true_
44 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
46 struct is_reference_to_const<T const volatile&> : mpl::true_
52 struct is_reference_to_function : mpl::false_
57 struct is_reference_to_function<T&> : is_function<T>
62 struct is_pointer_to_function : mpl::false_
66 // There's no such thing as a pointer-to-cv-function, so we don't need
67 // specializations for those
69 struct is_pointer_to_function<T*> : is_function<T>
74 struct is_reference_to_member_function_pointer_impl : mpl::false_
79 struct is_reference_to_member_function_pointer_impl<T&>
80 : is_member_function_pointer<typename remove_cv<T>::type>
86 struct is_reference_to_member_function_pointer
87 : is_reference_to_member_function_pointer_impl<T>
89 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
93 struct is_reference_to_function_pointer_aux
96 , is_pointer_to_function<
98 typename remove_reference<T>::type
103 // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
107 struct is_reference_to_function_pointer
109 is_reference_to_function<T>
111 , is_reference_to_function_pointer_aux<T>
117 struct is_reference_to_non_const
121 is_reference_to_const<T>
128 struct is_reference_to_volatile : mpl::false_
133 struct is_reference_to_volatile<T volatile&> : mpl::true_
137 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
139 struct is_reference_to_volatile<T const volatile&> : mpl::true_
146 struct is_reference_to_pointer : mpl::false_
151 struct is_reference_to_pointer<T*&> : mpl::true_
156 struct is_reference_to_pointer<T* const&> : mpl::true_
161 struct is_reference_to_pointer<T* volatile&> : mpl::true_
166 struct is_reference_to_pointer<T* const volatile&> : mpl::true_
171 struct is_reference_to_class
176 typename remove_reference<T>::type
181 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
185 struct is_pointer_to_class
190 typename remove_pointer<T>::type
195 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
201 using namespace indirect_traits;
203 }} // namespace boost::python::detail
205 #endif // INDIRECT_TRAITS_DWA2002131_HPP