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/integral_constant.hpp>
8 # include <boost/type_traits/is_function.hpp>
9 # include <boost/type_traits/is_reference.hpp>
10 # include <boost/type_traits/is_pointer.hpp>
11 # include <boost/type_traits/is_class.hpp>
12 # include <boost/type_traits/is_const.hpp>
13 # include <boost/type_traits/is_volatile.hpp>
14 # include <boost/type_traits/is_member_function_pointer.hpp>
15 # include <boost/type_traits/is_member_pointer.hpp>
16 # include <boost/type_traits/remove_cv.hpp>
17 # include <boost/type_traits/remove_reference.hpp>
18 # include <boost/type_traits/remove_pointer.hpp>
20 # include <boost/detail/workaround.hpp>
21 # include <boost/detail/select_type.hpp>
24 namespace boost { namespace detail {
26 namespace indirect_traits {
29 struct is_reference_to_const : boost::false_type
34 struct is_reference_to_const<T const&> : boost::true_type
38 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
40 struct is_reference_to_const<T const volatile&> : boost::true_type
46 struct is_reference_to_function : boost::false_type
51 struct is_reference_to_function<T&> : is_function<T>
56 struct is_pointer_to_function : boost::false_type
60 // There's no such thing as a pointer-to-cv-function, so we don't need
61 // specializations for those
63 struct is_pointer_to_function<T*> : is_function<T>
68 struct is_reference_to_member_function_pointer_impl : boost::false_type
73 struct is_reference_to_member_function_pointer_impl<T&>
74 : is_member_function_pointer<typename remove_cv<T>::type>
80 struct is_reference_to_member_function_pointer
81 : is_reference_to_member_function_pointer_impl<T>
86 struct is_reference_to_function_pointer_aux
87 : boost::integral_constant<bool,
88 is_reference<T>::value &&
89 is_pointer_to_function<
91 typename remove_reference<T>::type
96 // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
100 struct is_reference_to_function_pointer
101 : boost::detail::if_true<
102 is_reference_to_function<T>::value
105 , is_reference_to_function_pointer_aux<T>
111 struct is_reference_to_non_const
112 : boost::integral_constant<bool,
113 is_reference<T>::value &&
114 !is_reference_to_const<T>::value
120 struct is_reference_to_volatile : boost::false_type
125 struct is_reference_to_volatile<T volatile&> : boost::true_type
129 # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
131 struct is_reference_to_volatile<T const volatile&> : boost::true_type
138 struct is_reference_to_pointer : boost::false_type
143 struct is_reference_to_pointer<T*&> : boost::true_type
148 struct is_reference_to_pointer<T* const&> : boost::true_type
153 struct is_reference_to_pointer<T* volatile&> : boost::true_type
158 struct is_reference_to_pointer<T* const volatile&> : boost::true_type
163 struct is_reference_to_class
164 : boost::integral_constant<bool,
165 is_reference<T>::value &&
168 typename remove_reference<T>::type
176 struct is_pointer_to_class
177 : boost::integral_constant<bool,
178 is_pointer<T>::value &&
181 typename remove_pointer<T>::type
191 using namespace indirect_traits;
193 }} // namespace boost::python::detail
195 #endif // INDIRECT_TRAITS_DWA2002131_HPP