From 516adee94c93c795b0cafcd07cf99a1128717924 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Wed, 17 Apr 2002 02:25:46 +0000 Subject: [PATCH] for_each changes [SVN r13513] --- .../boost/python/object/class_converters.hpp | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/include/boost/python/object/class_converters.hpp b/include/boost/python/object/class_converters.hpp index fa35e1de..07d38976 100644 --- a/include/boost/python/object/class_converters.hpp +++ b/include/boost/python/object/class_converters.hpp @@ -7,7 +7,7 @@ # define CLASS_CONVERTERS_DWA2002119_HPP # include -# include +# include # include # include # include @@ -44,27 +44,19 @@ struct do_nothing template struct register_base_of { - // We're not using any state so we supply Ingored argument - template - struct apply + template void operator()(boost::mpl::identity) { - typedef void type; // 'type' needs to be defined for the same reasons + // Register the Base class + register_dynamic_id(); + // Register the up-cast + register_conversion(false); - // Here's the runtime part: - static void execute() - { - // Register the Base class - register_dynamic_id(); - // Register the up-cast - register_conversion(false); - - // Register the down-cast, if appropriate. - mpl::select_if_c< - is_polymorphic::value - , register_downcast - , do_nothing - >::type::execute(); - } + // Register the down-cast, if appropriate. + mpl::select_if_c< + is_polymorphic::value + , register_downcast + , do_nothing + >::type::execute(); }; }; @@ -84,7 +76,7 @@ inline void register_class_from_python(Derived* = 0, Bases* = 0) register_dynamic_id(); // register each base in the sequence - mpl::fold >::execute(); + mpl::for_each(register_base_of()); } }}} // namespace boost::python::object