sl@0: #ifndef OTHER_DWA20020601_HPP
sl@0: # define OTHER_DWA20020601_HPP
sl@0: 
sl@0: # include <boost/python/detail/prefix.hpp>
sl@0: // Copyright David Abrahams 2002.
sl@0: // Distributed under the Boost Software License, Version 1.0. (See
sl@0: // accompanying file LICENSE_1_0.txt or copy at
sl@0: // http://www.boost.org/LICENSE_1_0.txt)
sl@0: 
sl@0: # if _MSC_VER+0 >= 1020
sl@0: #  pragma once
sl@0: # endif
sl@0: 
sl@0: # include <boost/config.hpp>
sl@0: 
sl@0: namespace boost { namespace python {
sl@0: 
sl@0: template<class T> struct other
sl@0: { 
sl@0:     typedef T type;
sl@0: };
sl@0: 
sl@0: # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
sl@0: namespace detail
sl@0: {
sl@0:   template<typename T>
sl@0:   class is_other
sl@0:   {
sl@0:    public:
sl@0:       BOOST_STATIC_CONSTANT(bool, value = false); 
sl@0:   };
sl@0: 
sl@0:   template<typename T>
sl@0:   class is_other<other<T> >
sl@0:   {
sl@0:    public:
sl@0:       BOOST_STATIC_CONSTANT(bool, value = true);
sl@0:   };
sl@0: 
sl@0:   template<typename T>
sl@0:   class unwrap_other
sl@0:   {
sl@0:    public:
sl@0:       typedef T type;
sl@0:   };
sl@0: 
sl@0:   template<typename T>
sl@0:   class unwrap_other<other<T> >
sl@0:   {
sl@0:    public:
sl@0:       typedef T type;
sl@0:   };
sl@0: }
sl@0: # else // no partial specialization
sl@0: 
sl@0: }} // namespace boost::python
sl@0: 
sl@0: #include <boost/type.hpp>
sl@0: 
sl@0: namespace boost { namespace python {
sl@0: 
sl@0: namespace detail
sl@0: {
sl@0:   typedef char (&yes_other_t)[1];
sl@0:   typedef char (&no_other_t)[2];
sl@0:       
sl@0:   no_other_t is_other_test(...);
sl@0: 
sl@0:   template<typename T>
sl@0:   yes_other_t is_other_test(type< other<T> >);
sl@0: 
sl@0:   template<bool wrapped>
sl@0:   struct other_unwrapper
sl@0:   {
sl@0:       template <class T>
sl@0:       struct apply
sl@0:       {
sl@0:           typedef T type;
sl@0:       };
sl@0:   };
sl@0: 
sl@0:   template<>
sl@0:   struct other_unwrapper<true>
sl@0:   {
sl@0:       template <class T>
sl@0:       struct apply
sl@0:       {
sl@0:           typedef typename T::type type;
sl@0:       };
sl@0:   };
sl@0: 
sl@0:   template<typename T>
sl@0:   class is_other
sl@0:   {
sl@0:    public:
sl@0:       BOOST_STATIC_CONSTANT(
sl@0:           bool, value = (
sl@0:               sizeof(detail::is_other_test(type<T>()))
sl@0:               == sizeof(detail::yes_other_t)));
sl@0:   };
sl@0: 
sl@0:   template <typename T>
sl@0:   class unwrap_other
sl@0:       : public detail::other_unwrapper<
sl@0:       is_other<T>::value
sl@0:   >::template apply<T>
sl@0:   {};
sl@0: }
sl@0: 
sl@0: # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
sl@0: 
sl@0: }} // namespace boost::python
sl@0: 
sl@0: #endif // #ifndef OTHER_DWA20020601_HPP