Boost logo

Boost :

Subject: Re: [boost] [qvm] scalar_cast
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2012-11-06 19:12:37


On Mon, Nov 5, 2012 at 7:38 PM, Nikolay Mladenov
<nikolay.mladenov_at_[hidden]> wrote:
> it is almost as if operator * and / should have return type from the kind
> of deduce_v2<vec1, scalar2>

I think I got it. Incidentally, the documentation of deduce_v2 does
indicate that either one of its input types may be a non-vector type,
and that's precisely to support deducing the return type for
operations between a vector and something else (say, a matrix.) It
appears that your observation is correct, and that vector*scalar
should also use deduce_v2 to figure out its return type.

Can you make this change and see if it'll work with the rest of the
library? If all is well, I'll merge it back into the next release.

> I think I understood the reason for the right only scalar multiplication:
> it is probably because
> scalar*vec%X
> will do multiple times the work of
> vec%X * scalar

I thought about that but it wasn't my reasoning. I decided not to
define scalar multiplication on either side because I thought it isn't
_needed_. Having done that, I've been confused myself when I get
compile errors multiplying scalars on the left, so this is on my list
of things to be fixed.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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