Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2006-08-24 09:05:31


On Aug 24, 2006, at 7:24 PM, Andy Little wrote:

>>
>> energy = force*distance; // should this be allowed?
>> torque = force*distance; // should this be allowed?
>
> Quan allows this as it stands.

Good.

>
>> I think that in both cases the implicit conversion from the
>> (annonymous?) quantity force*distance to either energy or torque. I
>> think that to make the library usable one needs to allow these
>> conversions.
>
> The temporary result of force * distance is a so-called anonymous
> quantity.

OK

>
>> If one want to prevent the operations then because one is a vector
>> scalar product (the energy) and the other a vector cross product (the
>> torque) then this should be done at the level of the value_type of
>> the quantity and not at the unit level.
>
> Yes the obvious way to make a quantity a vector quantity is simple.
> Put it as
> the value_type of a vector. Currently quan has 2D and 3D vectors in
> separate
> namespaces, but it was suggested that it would be more flexible to
> just have a
> quan::simple_vector<N_dimensions,quantity> and hopefully that will be
> implemented at some stage.

Why not just use a ublas vector or MTL vector with a quan quantity?
As i mentioned before I see no reason for reinventing the wheel. I
still have not seen your reason for having your own vector classes.

Matthias


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