From 06beca39af62597cbd9b2bee39a3a6e439171a34 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 9 Jan 2004 07:26:47 +0000 Subject: [PATCH] merged from trunk [SVN r21559] --- include/boost/python/with_custodian_and_ward.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/boost/python/with_custodian_and_ward.hpp b/include/boost/python/with_custodian_and_ward.hpp index 01fd0d75..2b829138 100644 --- a/include/boost/python/with_custodian_and_ward.hpp +++ b/include/boost/python/with_custodian_and_ward.hpp @@ -16,13 +16,14 @@ namespace boost { namespace python { namespace detail { - template + template struct get_prev { template - static PyObject* execute(ArgumentPackage const& args, PyObject*) + static PyObject* execute(ArgumentPackage const& args, PyObject* = 0) { - return get<(N-1)>(args); + int const pre_n = static_cast(N) - 1; // separate line is gcc-2.96 workaround + return detail::get(mpl::int_(), args); } }; template <> @@ -59,8 +60,8 @@ struct with_custodian_and_ward : BasePolicy_ return false; } - PyObject* patient = detail::get(mpl::int_<(ward-1)>(), args_); - PyObject* nurse = detail::get(mpl::int_<(custodian-1)>(), args_); + PyObject* patient = detail::get_prev::execute(args_); + PyObject* nurse = detail::get_prev::execute(args_); PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient); if (life_support == 0) @@ -93,8 +94,8 @@ struct with_custodian_and_ward_postcall : BasePolicy_ return 0; } - PyObject* patient = ward > 0 ? detail::get(mpl::int_<(ward-1)>(),args_) : result; - PyObject* nurse = custodian > 0 ? detail::get(mpl::int_<(custodian-1)>(),args_) : result; + PyObject* patient = detail::get_prev::execute(args_, result); + PyObject* nurse = detail::get_prev::execute(args_, result); if (nurse == 0) return 0;