
"Pavel Chikulaev" <pavel.chikulaev@gmail.com> wrote in message news:d0k7sp$au4$1@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