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>
19
20# include <boost/detail/workaround.hpp>
21# include <boost/detail/select_type.hpp>
22
23
24namespace boost { namespace detail {
25
26namespace indirect_traits {
27
28template <class T>
29struct is_reference_to_const : boost::false_type
30{
31};
32
33template <class T>
34struct is_reference_to_const<T const&> : boost::true_type
35{
36};
37
38# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
39template<class T>
40struct is_reference_to_const<T const volatile&> : boost::true_type
41{
42};
43# endif
44
45template <class T>
46struct is_reference_to_function : boost::false_type
47{
48};
49
50template <class T>
51struct is_reference_to_function<T&> : is_function<T>
52{
53};
54
55template <class T>
56struct is_pointer_to_function : boost::false_type
57{
58};
59
60// There's no such thing as a pointer-to-cv-function, so we don't need
61// specializations for those
62template <class T>
63struct is_pointer_to_function<T*> : is_function<T>
64{
65};
66
67template <class T>
68struct is_reference_to_member_function_pointer_impl : boost::false_type
69{
70};
71
72template <class T>
73struct is_reference_to_member_function_pointer_impl<T&>
74 : is_member_function_pointer<typename remove_cv<T>::type>
75{
76};
77
78
79template <class T>
80struct is_reference_to_member_function_pointer
81 : is_reference_to_member_function_pointer_impl<T>
82{
83};
84
85template <class T>
86struct is_reference_to_function_pointer_aux
87 : boost::integral_constant<bool,
88 is_reference<T>::value &&
89 is_pointer_to_function<
90 typename remove_cv<
91 typename remove_reference<T>::type
92 >::type
93 >::value
94 >
95{
96 // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
97};
98
99template <class T>
100struct is_reference_to_function_pointer
101 : boost::detail::if_true<
102 is_reference_to_function<T>::value
103 >::template then<
104 boost::false_type
105 , is_reference_to_function_pointer_aux<T>
106 >::type
107{
108};
109
110template <class T>
111struct is_reference_to_non_const
112 : boost::integral_constant<bool,
113 is_reference<T>::value &&
114 !is_reference_to_const<T>::value
115 >
116{
117};
118
119template <class T>
120struct is_reference_to_volatile : boost::false_type
121{
122};
123
124template <class T>
125struct is_reference_to_volatile<T volatile&> : boost::true_type
126{
127};
128
129# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
130template <class T>
131struct is_reference_to_volatile<T const volatile&> : boost::true_type
132{
133};
134# endif
135
136
137template <class T>
138struct is_reference_to_pointer : boost::false_type
139{
140};
141
142template <class T>
143struct is_reference_to_pointer<T*&> : boost::true_type
144{
145};
146
147template <class T>
148struct is_reference_to_pointer<T* const&> : boost::true_type
149{
150};
151
152template <class T>
153struct is_reference_to_pointer<T* volatile&> : boost::true_type
154{
155};
156
157template <class T>
158struct is_reference_to_pointer<T* const volatile&> : boost::true_type
159{
160};
161
162template <class T>
163struct is_reference_to_class
164 : boost::integral_constant<bool,
165 is_reference<T>::value &&
166 is_class<
167 typename remove_cv<
168 typename remove_reference<T>::type
169 >::type
170 >::value
171 >
172{
173};
174
175template <class T>
176struct is_pointer_to_class
177 : boost::integral_constant<bool,
178 is_pointer<T>::value &&
179 is_class<
180 typename remove_cv<
181 typename remove_pointer<T>::type
182 >::type
183 >::value
184 >
185{
186};
187
188
189}
190
191using namespace indirect_traits;
192
193}} // namespace boost::python::detail
194
195#endif // INDIRECT_TRAITS_DWA2002131_HPP
196

source code of include/boost/detail/indirect_traits.hpp