1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/detail/indirect_traits.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,487 @@
1.4 +// Copyright David Abrahams 2002.
1.5 +// Distributed under the Boost Software License, Version 1.0. (See
1.6 +// accompanying file LICENSE_1_0.txt or copy at
1.7 +// http://www.boost.org/LICENSE_1_0.txt)
1.8 +#ifndef INDIRECT_TRAITS_DWA2002131_HPP
1.9 +# define INDIRECT_TRAITS_DWA2002131_HPP
1.10 +# include <boost/type_traits/is_function.hpp>
1.11 +# include <boost/type_traits/is_reference.hpp>
1.12 +# include <boost/type_traits/is_pointer.hpp>
1.13 +# include <boost/type_traits/is_class.hpp>
1.14 +# include <boost/type_traits/is_const.hpp>
1.15 +# include <boost/type_traits/is_volatile.hpp>
1.16 +# include <boost/type_traits/is_member_function_pointer.hpp>
1.17 +# include <boost/type_traits/is_member_pointer.hpp>
1.18 +# include <boost/type_traits/remove_cv.hpp>
1.19 +# include <boost/type_traits/remove_reference.hpp>
1.20 +# include <boost/type_traits/remove_pointer.hpp>
1.21 +
1.22 +# include <boost/type_traits/detail/ice_and.hpp>
1.23 +# include <boost/detail/workaround.hpp>
1.24 +
1.25 +# include <boost/mpl/eval_if.hpp>
1.26 +# include <boost/mpl/if.hpp>
1.27 +# include <boost/mpl/bool.hpp>
1.28 +# include <boost/mpl/and.hpp>
1.29 +# include <boost/mpl/not.hpp>
1.30 +# include <boost/mpl/aux_/lambda_support.hpp>
1.31 +
1.32 +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.33 +# include <boost/detail/is_function_ref_tester.hpp>
1.34 +# endif
1.35 +
1.36 +namespace boost { namespace detail {
1.37 +
1.38 +namespace indirect_traits {
1.39 +
1.40 +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.41 +template <class T>
1.42 +struct is_reference_to_const : mpl::false_
1.43 +{
1.44 +};
1.45 +
1.46 +template <class T>
1.47 +struct is_reference_to_const<T const&> : mpl::true_
1.48 +{
1.49 +};
1.50 +
1.51 +# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
1.52 +template<class T>
1.53 +struct is_reference_to_const<T const volatile&> : mpl::true_
1.54 +{
1.55 +};
1.56 +# endif
1.57 +
1.58 +template <class T>
1.59 +struct is_reference_to_function : mpl::false_
1.60 +{
1.61 +};
1.62 +
1.63 +template <class T>
1.64 +struct is_reference_to_function<T&> : is_function<T>
1.65 +{
1.66 +};
1.67 +
1.68 +template <class T>
1.69 +struct is_pointer_to_function : mpl::false_
1.70 +{
1.71 +};
1.72 +
1.73 +// There's no such thing as a pointer-to-cv-function, so we don't need
1.74 +// specializations for those
1.75 +template <class T>
1.76 +struct is_pointer_to_function<T*> : is_function<T>
1.77 +{
1.78 +};
1.79 +
1.80 +template <class T>
1.81 +struct is_reference_to_member_function_pointer_impl : mpl::false_
1.82 +{
1.83 +};
1.84 +
1.85 +template <class T>
1.86 +struct is_reference_to_member_function_pointer_impl<T&>
1.87 + : is_member_function_pointer<typename remove_cv<T>::type>
1.88 +{
1.89 +};
1.90 +
1.91 +
1.92 +template <class T>
1.93 +struct is_reference_to_member_function_pointer
1.94 + : is_reference_to_member_function_pointer_impl<T>
1.95 +{
1.96 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
1.97 +};
1.98 +
1.99 +template <class T>
1.100 +struct is_reference_to_function_pointer_aux
1.101 + : mpl::and_<
1.102 + is_reference<T>
1.103 + , is_pointer_to_function<
1.104 + typename remove_cv<
1.105 + typename remove_reference<T>::type
1.106 + >::type
1.107 + >
1.108 + >
1.109 +{
1.110 + // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
1.111 +};
1.112 +
1.113 +template <class T>
1.114 +struct is_reference_to_function_pointer
1.115 + : mpl::if_<
1.116 + is_reference_to_function<T>
1.117 + , mpl::false_
1.118 + , is_reference_to_function_pointer_aux<T>
1.119 + >::type
1.120 +{
1.121 +};
1.122 +
1.123 +template <class T>
1.124 +struct is_reference_to_non_const
1.125 + : mpl::and_<
1.126 + is_reference<T>
1.127 + , mpl::not_<
1.128 + is_reference_to_const<T>
1.129 + >
1.130 + >
1.131 +{
1.132 +};
1.133 +
1.134 +template <class T>
1.135 +struct is_reference_to_volatile : mpl::false_
1.136 +{
1.137 +};
1.138 +
1.139 +template <class T>
1.140 +struct is_reference_to_volatile<T volatile&> : mpl::true_
1.141 +{
1.142 +};
1.143 +
1.144 +# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
1.145 +template <class T>
1.146 +struct is_reference_to_volatile<T const volatile&> : mpl::true_
1.147 +{
1.148 +};
1.149 +# endif
1.150 +
1.151 +
1.152 +template <class T>
1.153 +struct is_reference_to_pointer : mpl::false_
1.154 +{
1.155 +};
1.156 +
1.157 +template <class T>
1.158 +struct is_reference_to_pointer<T*&> : mpl::true_
1.159 +{
1.160 +};
1.161 +
1.162 +template <class T>
1.163 +struct is_reference_to_pointer<T* const&> : mpl::true_
1.164 +{
1.165 +};
1.166 +
1.167 +template <class T>
1.168 +struct is_reference_to_pointer<T* volatile&> : mpl::true_
1.169 +{
1.170 +};
1.171 +
1.172 +template <class T>
1.173 +struct is_reference_to_pointer<T* const volatile&> : mpl::true_
1.174 +{
1.175 +};
1.176 +
1.177 +template <class T>
1.178 +struct is_reference_to_class
1.179 + : mpl::and_<
1.180 + is_reference<T>
1.181 + , is_class<
1.182 + typename remove_cv<
1.183 + typename remove_reference<T>::type
1.184 + >::type
1.185 + >
1.186 + >
1.187 +{
1.188 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
1.189 +};
1.190 +
1.191 +template <class T>
1.192 +struct is_pointer_to_class
1.193 + : mpl::and_<
1.194 + is_pointer<T>
1.195 + , is_class<
1.196 + typename remove_cv<
1.197 + typename remove_pointer<T>::type
1.198 + >::type
1.199 + >
1.200 + >
1.201 +{
1.202 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
1.203 +};
1.204 +
1.205 +# else
1.206 +
1.207 +using namespace boost::detail::is_function_ref_tester_;
1.208 +
1.209 +typedef char (&inner_yes_type)[3];
1.210 +typedef char (&inner_no_type)[2];
1.211 +typedef char (&outer_no_type)[1];
1.212 +
1.213 +template <typename V>
1.214 +struct is_const_help
1.215 +{
1.216 + typedef typename mpl::if_<
1.217 + is_const<V>
1.218 + , inner_yes_type
1.219 + , inner_no_type
1.220 + >::type type;
1.221 +};
1.222 +
1.223 +template <typename V>
1.224 +struct is_volatile_help
1.225 +{
1.226 + typedef typename mpl::if_<
1.227 + is_volatile<V>
1.228 + , inner_yes_type
1.229 + , inner_no_type
1.230 + >::type type;
1.231 +};
1.232 +
1.233 +template <typename V>
1.234 +struct is_pointer_help
1.235 +{
1.236 + typedef typename mpl::if_<
1.237 + is_pointer<V>
1.238 + , inner_yes_type
1.239 + , inner_no_type
1.240 + >::type type;
1.241 +};
1.242 +
1.243 +template <typename V>
1.244 +struct is_class_help
1.245 +{
1.246 + typedef typename mpl::if_<
1.247 + is_class<V>
1.248 + , inner_yes_type
1.249 + , inner_no_type
1.250 + >::type type;
1.251 +};
1.252 +
1.253 +template <class T>
1.254 +struct is_reference_to_function_aux
1.255 +{
1.256 + static T t;
1.257 + BOOST_STATIC_CONSTANT(
1.258 + bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type));
1.259 + typedef mpl::bool_<value> type;
1.260 + };
1.261 +
1.262 +template <class T>
1.263 +struct is_reference_to_function
1.264 + : mpl::if_<is_reference<T>, is_reference_to_function_aux<T>, mpl::bool_<false> >::type
1.265 +{
1.266 +};
1.267 +
1.268 +template <class T>
1.269 +struct is_pointer_to_function_aux
1.270 +{
1.271 + static T t;
1.272 + BOOST_STATIC_CONSTANT(
1.273 + bool, value
1.274 + = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
1.275 + typedef mpl::bool_<value> type;
1.276 +};
1.277 +
1.278 +template <class T>
1.279 +struct is_pointer_to_function
1.280 + : mpl::if_<is_pointer<T>, is_pointer_to_function_aux<T>, mpl::bool_<false> >::type
1.281 +{
1.282 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T))
1.283 +};
1.284 +
1.285 +struct false_helper1
1.286 +{
1.287 + template <class T>
1.288 + struct apply : mpl::false_
1.289 + {
1.290 + };
1.291 +};
1.292 +
1.293 +template <typename V>
1.294 +typename is_const_help<V>::type reference_to_const_helper(V&);
1.295 +outer_no_type
1.296 +reference_to_const_helper(...);
1.297 +
1.298 +struct true_helper1
1.299 +{
1.300 + template <class T>
1.301 + struct apply
1.302 + {
1.303 + static T t;
1.304 + BOOST_STATIC_CONSTANT(
1.305 + bool, value
1.306 + = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type));
1.307 + typedef mpl::bool_<value> type;
1.308 + };
1.309 +};
1.310 +
1.311 +template <bool ref = true>
1.312 +struct is_reference_to_const_helper1 : true_helper1
1.313 +{
1.314 +};
1.315 +
1.316 +template <>
1.317 +struct is_reference_to_const_helper1<false> : false_helper1
1.318 +{
1.319 +};
1.320 +
1.321 +
1.322 +template <class T>
1.323 +struct is_reference_to_const
1.324 + : is_reference_to_const_helper1<is_reference<T>::value>::template apply<T>
1.325 +{
1.326 +};
1.327 +
1.328 +
1.329 +template <bool ref = true>
1.330 +struct is_reference_to_non_const_helper1
1.331 +{
1.332 + template <class T>
1.333 + struct apply
1.334 + {
1.335 + static T t;
1.336 + BOOST_STATIC_CONSTANT(
1.337 + bool, value
1.338 + = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type));
1.339 +
1.340 + typedef mpl::bool_<value> type;
1.341 + };
1.342 +};
1.343 +
1.344 +template <>
1.345 +struct is_reference_to_non_const_helper1<false> : false_helper1
1.346 +{
1.347 +};
1.348 +
1.349 +
1.350 +template <class T>
1.351 +struct is_reference_to_non_const
1.352 + : is_reference_to_non_const_helper1<is_reference<T>::value>::template apply<T>
1.353 +{
1.354 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T))
1.355 +};
1.356 +
1.357 +
1.358 +template <typename V>
1.359 +typename is_volatile_help<V>::type reference_to_volatile_helper(V&);
1.360 +outer_no_type
1.361 +reference_to_volatile_helper(...);
1.362 +
1.363 +template <bool ref = true>
1.364 +struct is_reference_to_volatile_helper1
1.365 +{
1.366 + template <class T>
1.367 + struct apply
1.368 + {
1.369 + static T t;
1.370 + BOOST_STATIC_CONSTANT(
1.371 + bool, value
1.372 + = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type));
1.373 + typedef mpl::bool_<value> type;
1.374 + };
1.375 +};
1.376 +
1.377 +template <>
1.378 +struct is_reference_to_volatile_helper1<false> : false_helper1
1.379 +{
1.380 +};
1.381 +
1.382 +
1.383 +template <class T>
1.384 +struct is_reference_to_volatile
1.385 + : is_reference_to_volatile_helper1<is_reference<T>::value>::template apply<T>
1.386 +{
1.387 +};
1.388 +
1.389 +template <typename V>
1.390 +typename is_pointer_help<V>::type reference_to_pointer_helper(V&);
1.391 +outer_no_type reference_to_pointer_helper(...);
1.392 +
1.393 +template <class T>
1.394 +struct reference_to_pointer_impl
1.395 +{
1.396 + static T t;
1.397 + BOOST_STATIC_CONSTANT(
1.398 + bool, value
1.399 + = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
1.400 + );
1.401 +
1.402 + typedef mpl::bool_<value> type;
1.403 +};
1.404 +
1.405 +template <class T>
1.406 +struct is_reference_to_pointer
1.407 + : mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type
1.408 +{
1.409 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
1.410 +};
1.411 +
1.412 +template <class T>
1.413 +struct is_reference_to_function_pointer
1.414 + : mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type
1.415 +{
1.416 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
1.417 +};
1.418 +
1.419 +
1.420 +template <class T>
1.421 +struct is_member_function_pointer_help
1.422 + : mpl::if_<is_member_function_pointer<T>, inner_yes_type, inner_no_type>
1.423 +{};
1.424 +
1.425 +template <typename V>
1.426 +typename is_member_function_pointer_help<V>::type member_function_pointer_helper(V&);
1.427 +outer_no_type member_function_pointer_helper(...);
1.428 +
1.429 +template <class T>
1.430 +struct is_pointer_to_member_function_aux
1.431 +{
1.432 + static T t;
1.433 + BOOST_STATIC_CONSTANT(
1.434 + bool, value
1.435 + = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type));
1.436 + typedef mpl::bool_<value> type;
1.437 +};
1.438 +
1.439 +template <class T>
1.440 +struct is_reference_to_member_function_pointer
1.441 + : mpl::if_<
1.442 + is_reference<T>
1.443 + , is_pointer_to_member_function_aux<T>
1.444 + , mpl::bool_<false>
1.445 + >::type
1.446 +{
1.447 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
1.448 +};
1.449 +
1.450 +template <typename V>
1.451 +typename is_class_help<V>::type reference_to_class_helper(V const volatile&);
1.452 +outer_no_type reference_to_class_helper(...);
1.453 +
1.454 +template <class T>
1.455 +struct is_reference_to_class
1.456 +{
1.457 + static T t;
1.458 + BOOST_STATIC_CONSTANT(
1.459 + bool, value
1.460 + = (is_reference<T>::value
1.461 + & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type)))
1.462 + );
1.463 + typedef mpl::bool_<value> type;
1.464 + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
1.465 +};
1.466 +
1.467 +template <typename V>
1.468 +typename is_class_help<V>::type pointer_to_class_helper(V const volatile*);
1.469 +outer_no_type pointer_to_class_helper(...);
1.470 +
1.471 +template <class T>
1.472 +struct is_pointer_to_class
1.473 +{
1.474 + static T t;
1.475 + BOOST_STATIC_CONSTANT(
1.476 + bool, value
1.477 + = (is_pointer<T>::value
1.478 + && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type))
1.479 + );
1.480 + typedef mpl::bool_<value> type;
1.481 +};
1.482 +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.483 +
1.484 +}
1.485 +
1.486 +using namespace indirect_traits;
1.487 +
1.488 +}} // namespace boost::python::detail
1.489 +
1.490 +#endif // INDIRECT_TRAITS_DWA2002131_HPP