From 042735fd06012d99fe7bad85f33d888f7b2cbff9 Mon Sep 17 00:00:00 2001 From: Tobias Schwinger Date: Fri, 13 Jul 2007 18:31:16 +0000 Subject: [PATCH] ported to boost::result_of-based result computation scheme [SVN r38206] --- example/cookbook/do_the_bind.cpp | 38 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/example/cookbook/do_the_bind.cpp b/example/cookbook/do_the_bind.cpp index 1967e956..d824c67f 100644 --- a/example/cookbook/do_the_bind.cpp +++ b/example/cookbook/do_the_bind.cpp @@ -91,8 +91,11 @@ namespace impl return bound; } - template - struct result + template + struct result; + + template + struct result< Self (T) > : mpl::eval_if< is_placeholder, result_of::at::type>, mpl::identity @@ -113,15 +116,11 @@ namespace impl : fsq_bind_args(bind_args) { } - template ::value && - !! mpl::count_if >::value) > - struct result - { }; + template + struct result; template - struct result + struct result_impl : result_of::invoke< typename result_of::front::type, typename result_of::transform< typename result_of::pop_front::type, @@ -130,8 +129,13 @@ namespace impl > { }; + template + struct result< Self (FinalArgs) > + : result_impl< typename boost::remove_reference::type > + { }; + template - inline typename result::type + inline typename result_impl::type operator()(FinalArgs const & final_args) const { return fusion::invoke( fusion::front(this->fsq_bind_args), @@ -145,8 +149,11 @@ namespace impl // Fused implementation of the 'bind' function struct fused_binder { + template + struct result; + template - struct result + struct result_impl { // We have to transform the arguments so they are held by-value // in the returned function. @@ -154,11 +161,16 @@ namespace impl fused_bound_function > type; }; + template + struct result< Self (BindArgs) > + : result_impl< typename boost::remove_reference::type > + { }; + template - inline typename result::type + inline typename result_impl< BindArgs >::type operator()(BindArgs & bind_args) const { - return typename result::type(bind_args); + return typename result< void(BindArgs) >::type(bind_args); } };