os/ossrv/ossrv_pub/boost_apis/boost/python/bases.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/python/bases.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,68 @@
     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 BASES_DWA2002321_HPP
     1.9 +# define BASES_DWA2002321_HPP
    1.10 +
    1.11 +# include <boost/python/detail/prefix.hpp>
    1.12 +# include <boost/type_traits/object_traits.hpp>
    1.13 +# include <boost/python/detail/type_list.hpp>
    1.14 +# include <boost/mpl/if.hpp>
    1.15 +# include <boost/mpl/bool.hpp>
    1.16 +# include <boost/preprocessor/enum_params_with_a_default.hpp>
    1.17 +# include <boost/preprocessor/enum_params.hpp>
    1.18 +
    1.19 +namespace boost { namespace python { 
    1.20 +
    1.21 +# define BOOST_PYTHON_BASE_PARAMS BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, Base)
    1.22 +
    1.23 +  // A type list for specifying bases
    1.24 +  template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename Base, mpl::void_) >
    1.25 +  struct bases : detail::type_list< BOOST_PYTHON_BASE_PARAMS >::type
    1.26 +  {};
    1.27 +
    1.28 +  namespace detail
    1.29 +  {
    1.30 +# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
    1.31 +    template <class T> struct specifies_bases
    1.32 +        : mpl::false_
    1.33 +    {
    1.34 +    };
    1.35 +    
    1.36 +    template < BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, class Base) >
    1.37 +    struct specifies_bases< bases< BOOST_PYTHON_BASE_PARAMS > >
    1.38 +        : mpl::true_
    1.39 +    {
    1.40 +    };
    1.41 +# else
    1.42 +    template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class Base) >
    1.43 +    static char is_bases_helper(bases< BOOST_PYTHON_BASE_PARAMS > const&);
    1.44 +    
    1.45 +    static char (& is_bases_helper(...) )[256];
    1.46 +
    1.47 +    template <class T>
    1.48 +    struct specifies_bases
    1.49 +    {
    1.50 +     private:
    1.51 +        static typename add_reference<T>::type make();
    1.52 +        BOOST_STATIC_CONSTANT(bool, non_ref = !is_reference<T>::value);
    1.53 +     public:
    1.54 +        BOOST_STATIC_CONSTANT(bool, value = non_ref & (sizeof(is_bases_helper(make())) == 1));
    1.55 +        typedef mpl::bool_<value> type;
    1.56 +    };
    1.57 +# endif
    1.58 +    template <class T, class Prev = bases<> >
    1.59 +    struct select_bases
    1.60 +        : mpl::if_<
    1.61 +                specifies_bases<T>
    1.62 +                , T
    1.63 +                , Prev
    1.64 +          >
    1.65 +    {
    1.66 +    };
    1.67 +  }
    1.68 +# undef BOOST_PYTHON_BASE_PARAMS
    1.69 +}} // namespace boost::python
    1.70 +
    1.71 +#endif // BASES_DWA2002321_HPP