Update of /cvsroot/boost/boost/libs/fusion/example/cookbook
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv895
Modified Files:
do_the_bind.cpp
Log Message:
ported to boost::result_of-based result computation scheme
Index: do_the_bind.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/fusion/example/cookbook/do_the_bind.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- do_the_bind.cpp 16 Mar 2007 15:14:46 -0000 1.2
+++ do_the_bind.cpp 13 Jul 2007 18:31:16 -0000 1.3
@@ -91,8 +91,11 @@
return bound;
}
- template <typename T>
- struct result
+ template <typename Signature>
+ struct result;
+
+ template <class Self, typename T>
+ struct result< Self (T) >
: mpl::eval_if< is_placeholder<T>,
result_of::at<FinalArgs,typename
boost::remove_reference<T>::type>,
mpl::identity<T>
@@ -113,15 +116,11 @@
: fsq_bind_args(bind_args)
{ }
- template <class FinalArgs, bool Enable =
- // Disable for empty sequences if we expect arguments
- ! (result_of::empty<FinalArgs>::value &&
- !! mpl::count_if<bound_args,is_placeholder<_> >::value) >
- struct result
- { };
+ template <typename Signature>
+ struct result;
template <class FinalArgs>
- struct result<FinalArgs,true>
+ struct result_impl
: result_of::invoke< typename result_of::front<bound_args>::type,
typename result_of::transform<
typename result_of::pop_front<bound_args>::type,
@@ -130,8 +129,13 @@
>
{ };
+ template <class Self, class FinalArgs>
+ struct result< Self (FinalArgs) >
+ : result_impl< typename boost::remove_reference<FinalArgs>::type >
+ { };
+
template <class FinalArgs>
- inline typename result<FinalArgs>::type
+ inline typename result_impl<FinalArgs>::type
operator()(FinalArgs const & final_args) const
{
return fusion::invoke( fusion::front(this->fsq_bind_args),
@@ -145,8 +149,11 @@
// Fused implementation of the 'bind' function
struct fused_binder
{
+ template <class Signature>
+ struct result;
+
template <class BindArgs>
- 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 @@
fused_bound_function<BindArgs> > type;
};
+ template <class Self, class BindArgs>
+ struct result< Self (BindArgs) >
+ : result_impl< typename boost::remove_reference<BindArgs>::type >
+ { };
+
template <class BindArgs>
- inline typename result<BindArgs>::type
+ inline typename result_impl< BindArgs >::type
operator()(BindArgs & bind_args) const
{
- return typename result<BindArgs>::type(bind_args);
+ return typename result< void(BindArgs) >::type(bind_args);
}
};
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs