Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-01-07 04:33:36


Andy Little wrote:
> "Daniel Frey" <daniel.frey_at_[hidden]> wrote
>
> My syntax in my physical_quantities type for this is:
>
> q_velocity::m_div_s s(2);
>
> one could quibble about the naming:
>
> q_speed::m_per_s s(2);
> q_speed::m_ovr_s s(2);

I know that you are using a different naming scheme. I was just
addressing the people advocating the alternative ( 5 * meters ). I am
among these people, so I'd like to see if there is a solution which
keeps the spirit of the 5*meters syntax. You version is totally
different, so I think we should develop several alternatives
independently, see how far we get and then compare them. From what I've
seen so far, a lot of people are interested in a unit library, but there
isn't any consensus on the details. We are still in the brain-storming
phase, are we? (Yes, there are complete implementations which are
sufficient for *some* domains...)

> Unless I'm missing something it is also as legible if not more so and
> if operator *() is actually a runtime multiplication in the top example
> over which there seems to be some confusion, better in raw performance
> terms,
> (no runtime multiplication involved in my declaration).
> which I had thought was a critical factor to many.
>
> Alternatively if operator *() does not mean multiplication in the top
> example,
> then it is rather a misuse of the operator IMO.

It's hard to tell. From what I did, the *meters behaved like a
multiplication with 1, but it was not actually performed. "meters"
wasn't a "real" constant, only a helper with a special type. You
couldn't say:

unit::length<double> l = unit::m;

you needed to write

unit::length<double> l = 1.L * unit::m;

(1 instead of 1.L was also sufficient) but as I mentioned in another
post, I need far more time to think about this. Will do when the
constant libraries documentation is finished, but don't hold your breath ;)

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