-----Original Message-----
From: boost-users-bounces@lists.boost.org on behalf of Sohail Somani
Sent: Sat 1/20/2007 8:48 AM
To: boost-users@lists.boost.org; boost-users@lists.boost.org
Subject: Re: [Boost-users] [Fusion]fusion::traits::is_sequence<->mpl::is_sequence?
-----Original Message-----
From: boost-users-bounces@lists.boost.org on behalf of Joel de Guzman
That supports my quick theories. For Sohail, who's doing a non-intrusive
adaptation, he'll need to specialize the mpl::sequence_tag.
------
I think I'll stick with fusion::result_of for now ;)
------
I take that back! I do need some of the mpl algorithms. Anyway, while it may not seem that much (I'm a total metaprogramming noob), my progress is below. I can safely say that there haven't been too many frustrations, which surprises me. If I had the mpl book (/me shakes fist @ chapters.ca), I probably would have gotten through it faster. Now what I need is to use max_element on the argument position of all the placeholders and we're done!
template<int NumPlaceholders, typename BindExpression>
void count_placeholders(BindExpression)
{
typedef typename boost::bind_arg_sequence<BindExpression>::type bind_arg_sequence;
typedef typename result_of::filter_if
<
bind_arg_sequence
, boost::is_placeholder<mpl::_1>
>::type placeholders;
BOOST_STATIC_ASSERT(( result_of::size<placeholders>::value == NumPlaceholders));
}
void fn_0(){}
void fn_1(int){}
void fn_2(int,int){}
MPL_TEST_CASE()
{
count_placeholders<0>(boost::bind(&fn_0));
count_placeholders<2>(boost::bind(&fn_2,_1,_2));
}