2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Elimination of boost/python/detail/eval.hpp; using mpl::apply instead

[SVN r13176]
This commit is contained in:
Dave Abrahams
2002-03-11 18:57:45 +00:00
parent bccd854676
commit 23769371bc
5 changed files with 43 additions and 83 deletions

View File

@@ -7,7 +7,6 @@
# define CALLER_DWA20011214_HPP
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/detail/eval.hpp>
# include <boost/python/detail/returning.hpp>
# include <boost/mpl/select_type.hpp>
# include <boost/type_traits/composite_traits.hpp>

View File

@@ -1,40 +0,0 @@
// Copyright David Abrahams 2002. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#ifndef EVAL_DWA2002124_HPP
# define EVAL_DWA2002124_HPP
# include <boost/mpl/apply.hpp>
namespace boost { namespace python { namespace detail {
template <class T> struct undefined;
template <class UnaryMetaFunction, class T>
struct eval
{
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1200
// based on the (non-conforming) MSVC trick from MPL
template<bool>
struct unarymetafunction_vc : UnaryMetaFunction {};
// illegal C++ which causes VC to admit that unarymetafunction_vc
// can have a nested template:
template<>
struct unarymetafunction_vc<true>
{
template<class> struct apply;
};
typedef typename unarymetafunction_vc<
::boost::mpl::detail::msvc_never_true<UnaryMetaFunction>::value
>::template apply<T>::type type;
# else
typedef typename UnaryMetaFunction::template apply<T>::type type;
# endif
};
}}} // namespace boost::python::detail
#endif // EVAL_DWA2002124_HPP

View File

@@ -15,6 +15,7 @@
# include <boost/config.hpp>
# include <boost/python/detail/none.hpp>
# include <boost/python/from_python.hpp>
# include <boost/mpl/apply.hpp>
namespace boost { namespace python { namespace detail {
@@ -31,7 +32,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -52,7 +53,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -75,7 +76,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -101,7 +102,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -130,7 +131,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -162,7 +163,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -186,7 +187,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -207,7 +208,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -230,7 +231,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -256,7 +257,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -285,7 +286,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -317,7 +318,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -341,7 +342,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -362,7 +363,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -385,7 +386,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -411,7 +412,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -440,7 +441,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -472,7 +473,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -499,7 +500,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -520,7 +521,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -543,7 +544,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -569,7 +570,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -598,7 +599,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -630,7 +631,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -652,7 +653,7 @@ struct returning
{
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -671,7 +672,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -692,7 +693,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -716,7 +717,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -743,7 +744,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -773,7 +774,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;
@@ -806,7 +807,7 @@ struct returning
// find the result converter
typedef typename P::result_converter result_converter;
typename eval<result_converter,R>::type cr;
typename mpl::apply1<result_converter,R>::type cr;
if (!cr.convertible()) return 0;
if (!policies.precall(args_)) return 0;

View File

@@ -10,7 +10,7 @@
# include <boost/python/object/forward.hpp>
# include <boost/python/object/class.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/python/detail/eval.hpp>
# include <boost/mpl/apply.hpp>
namespace boost { namespace python { namespace objects {
@@ -22,7 +22,7 @@ struct make_holder<0>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
static void execute(
PyObject* p)
{
@@ -38,7 +38,7 @@ struct make_holder<1>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
@@ -57,7 +57,7 @@ struct make_holder<2>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
typedef typename mpl::at<1,ArgList>::type t1;
@@ -77,7 +77,7 @@ struct make_holder<3>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
typedef typename mpl::at<1,ArgList>::type t1;
@@ -99,7 +99,7 @@ struct make_holder<4>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
typedef typename mpl::at<1,ArgList>::type t1;
@@ -123,7 +123,7 @@ struct make_holder<5>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
typedef typename mpl::at<1,ArgList>::type t1;
@@ -149,7 +149,7 @@ struct make_holder<6>
template <class T, class Generator, class ArgList>
struct apply
{
typedef typename python::detail::eval<Generator,T>::type holder;
typedef typename mpl::apply1<Generator,T>::type holder;
typedef typename mpl::at<0,ArgList>::type t0;
typedef typename forward<t0>::type f0;
typedef typename mpl::at<1,ArgList>::type t1;

View File

@@ -9,10 +9,10 @@
# include <boost/python/object/class.hpp>
# include <boost/python/converter/type_id.hpp>
# include <boost/python/object/inheritance.hpp>
# include <boost/python/detail/eval.hpp>
# include <boost/ref.hpp>
# include <boost/type.hpp>
# include <boost/mpl/select_type.hpp>
# include <boost/mpl/apply.hpp>
namespace boost { namespace python { namespace objects {
@@ -306,7 +306,7 @@ namespace detail
template <class Held>
struct apply
{
typedef typename boost::python::detail::eval<
typedef typename mpl::apply1<
PointerGenerator,BackReferenceType
>::type pointer;
@@ -320,7 +320,7 @@ namespace detail
template <class Held>
struct apply
{
typedef typename boost::python::detail::eval<
typedef typename mpl::apply1<
PointerGenerator,Held
>::type pointer;