|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-01-07 03:38:05
Reece Dunn wrote:
> Jan Langer wrote:
>> i do not really know what you mean, but 5 * meter(s) looks very
>> natural to me. a scalar factor 5 is multiplied to a length of a meter,
>> which results in a length of 5 meters. if you have an implicit
>> value_type and if you assume to be solely in a specific units system,
>> the syntax
>> length l = 5*meters;
>> expresses all facts.
FWIW this is also the syntax I used when I played with a unit library
some months ago. Hadn't taken the time to go further, though, but it
seemed a natural syntax to me, too.
> Speed s = 2 m / s;
This is one of the pitfalls! I haven't found a solution, but I'd like to
point out that it is a problem which needs to be addressed. Units often
have very brief identifiers which than clash too easily with the
variables one usually uses. And you don't want to write
unit::Speed s = 2 * unit::m / unit::s;
all the time, do you? I'm not very constructive, I know... :)
Regards, Daniel
-- Daniel Frey aixigo AG - financial solutions & technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk