Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-09-09 06:27:40


Andy Little wrote:

>> You must've missed this: Dan wrote me an email a while back. He
>> says: "Interestingly using fusion::fold to do maths on boost::arrays,
>> I'm finding that with vc8.0 fusion significantly outperforms the
>> standard library equivalent code, presumably as it has more
>> information available at compile time, and with inlining it
>> effectively unrolls the entire loops."
>>
>> I asked Dan to add his tests to libs/fusion/example to showcase
>> this favorable "phenomena" :-).
>
> I can't find that, but I am probably looking in the wrong place. Do you mean
> Boost CVS?

Sorry, you'll have to wait a bit more. Dan says he'll do it over
the weekend.

> BTW. By using a tuple rather than an array, then you can use representing zero
> and one. IOW zero<T> one<T> .
>
> hence:
>
> template <typename TL, typename TR>
> zero<typeof(TL() * TR() )>
> operator *( Tl , zero<TR>)
> {
> return zero<typeof(TL() * TR() )>();
> }
> It should be relatively simple for the compiler to optimise such calcs away.
> Very useful for matrix calcs.
> (originally suggested by Geoffrey Irving).

Indeed. Also, with Fusion, you have the option to use purely
constant sequences such as mpl::vector_c together with plain
sequences, or even user defined sequences and adapted/converted
structs/classes.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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