Boost logo

Boost :

From: João Abecasis (jpabecasis_at_[hidden])
Date: 2006-05-13 22:36:25


Larry Evans wrote:
> On 05/07/2006 02:19 PM, João Abecasis wrote:
>> 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)

How about:

seq - a model of Forward Sequence
f - a N-ary functor or function pointer, with
      N = result_of::size<Seq>::value

Semantics: returns the result of invoking n-ary f, using the elements of
seq as arguments.

?

> 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.

I guess I didn't write that test thinking that it would get used as
documentation... :-( It seems I should. I'll give it another try soonish.

Thanks for your comments,

João


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