Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-05-07 16:47:58


On 05/07/2006 02:19 PM, João Abecasis wrote:
> Tobias Schwinger wrote:
>
>>2. I'm also missing a fusion-equivalent to mpl::unpack_args (that would be about the inverse of 1).
>
>
> Actually there already is a fusion::unpack_args, alas it is
[snip]
> Anyway, you can find this in
>
> boost/fusion/sequence/utility/unpack_args.hpp
>
> and use it thusly,
>
> boost::fusion::unpack_args(f, seq);
>
> where f is a functor or function pointer and seq is a fusion Sequence.
[snip]
> The effect is that of invoking f with each element of seq as an argument.

The last statement might be interpreted to mean:

   typedef boost::fusion::vector<object, int> vector2;
   vector2 v2(o, 17);

   unpack_args(f,v2) == vector2(f(o),f(17))

instead of:

   unpack_args(f,v2) == f(o,17)

where the above code is from that in:

   libs/fusion/test/sequence/unpack_args.cpp

BTW, the purpose of unpack_args would be easier to
see if the actual tests were more like:

   BOOST_TEST(f(o,17) == unpack_args( f , v2 ));

instead of:

   BOOST_TEST(f.get() - 17 == unpack_args( f , v2 ));

Then the reader would just have to look at the v2 declaration:

   vector2 v2(o, 17);

to see the purpose, IMHO.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk