1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/python/other.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,114 @@
1.4 +#ifndef OTHER_DWA20020601_HPP
1.5 +# define OTHER_DWA20020601_HPP
1.6 +
1.7 +# include <boost/python/detail/prefix.hpp>
1.8 +// Copyright David Abrahams 2002.
1.9 +// Distributed under the Boost Software License, Version 1.0. (See
1.10 +// accompanying file LICENSE_1_0.txt or copy at
1.11 +// http://www.boost.org/LICENSE_1_0.txt)
1.12 +
1.13 +# if _MSC_VER+0 >= 1020
1.14 +# pragma once
1.15 +# endif
1.16 +
1.17 +# include <boost/config.hpp>
1.18 +
1.19 +namespace boost { namespace python {
1.20 +
1.21 +template<class T> struct other
1.22 +{
1.23 + typedef T type;
1.24 +};
1.25 +
1.26 +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.27 +namespace detail
1.28 +{
1.29 + template<typename T>
1.30 + class is_other
1.31 + {
1.32 + public:
1.33 + BOOST_STATIC_CONSTANT(bool, value = false);
1.34 + };
1.35 +
1.36 + template<typename T>
1.37 + class is_other<other<T> >
1.38 + {
1.39 + public:
1.40 + BOOST_STATIC_CONSTANT(bool, value = true);
1.41 + };
1.42 +
1.43 + template<typename T>
1.44 + class unwrap_other
1.45 + {
1.46 + public:
1.47 + typedef T type;
1.48 + };
1.49 +
1.50 + template<typename T>
1.51 + class unwrap_other<other<T> >
1.52 + {
1.53 + public:
1.54 + typedef T type;
1.55 + };
1.56 +}
1.57 +# else // no partial specialization
1.58 +
1.59 +}} // namespace boost::python
1.60 +
1.61 +#include <boost/type.hpp>
1.62 +
1.63 +namespace boost { namespace python {
1.64 +
1.65 +namespace detail
1.66 +{
1.67 + typedef char (&yes_other_t)[1];
1.68 + typedef char (&no_other_t)[2];
1.69 +
1.70 + no_other_t is_other_test(...);
1.71 +
1.72 + template<typename T>
1.73 + yes_other_t is_other_test(type< other<T> >);
1.74 +
1.75 + template<bool wrapped>
1.76 + struct other_unwrapper
1.77 + {
1.78 + template <class T>
1.79 + struct apply
1.80 + {
1.81 + typedef T type;
1.82 + };
1.83 + };
1.84 +
1.85 + template<>
1.86 + struct other_unwrapper<true>
1.87 + {
1.88 + template <class T>
1.89 + struct apply
1.90 + {
1.91 + typedef typename T::type type;
1.92 + };
1.93 + };
1.94 +
1.95 + template<typename T>
1.96 + class is_other
1.97 + {
1.98 + public:
1.99 + BOOST_STATIC_CONSTANT(
1.100 + bool, value = (
1.101 + sizeof(detail::is_other_test(type<T>()))
1.102 + == sizeof(detail::yes_other_t)));
1.103 + };
1.104 +
1.105 + template <typename T>
1.106 + class unwrap_other
1.107 + : public detail::other_unwrapper<
1.108 + is_other<T>::value
1.109 + >::template apply<T>
1.110 + {};
1.111 +}
1.112 +
1.113 +# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.114 +
1.115 +}} // namespace boost::python
1.116 +
1.117 +#endif // #ifndef OTHER_DWA20020601_HPP