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