Boost logo

Boost :

From: Pavel Chikulaev (pavel.chikulaev_at_[hidden])
Date: 2005-03-09 07:51:23


"Pavel Chikulaev" <pavel.chikulaev_at_[hidden]> wrote in message
news:d0k7sp$au4$1_at_sea.gmane.org...
>> It's nice when the cross product implementation can indicate by the
>> paramter type of its signature that it needs an intermediate result
>> (otherwise it would have to evalutate the expression explicitly or
>> direction * std::sin(a*half) will be evaluated twice).
>
> It won't be evaluated twice, AFAIK.

One more oops.

It will be in only one rare case:
    xpd(LAZY_OP_RESULT_OF(your_vector));
//anything lazy-convertible to vector.
//will not be evaluated before calling xpd

But in most cases you should write:
    xpd(const your_vector &);
//Lazy expression will be evaluated before
//calling xpd

Also have lazy::evaluate( ) function to evaluate lazy-expression whenever
you want.

--
Pavel Chikulaev 

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