Boost logo

Boost :

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

David B. Held wrote:
> "Daniel Frey" <daniel.frey_at_[hidden]> wrote in message
> news:btgghe$7rh$
>>> 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 would do two things. 1) put all the units in their own namespace,
> so people can fully qualify them if need be. 2) spell out the units,
> using abbreviations where necessary to make them conveniently
> short. Also, I know the precedence is wrong, but it would be
> really nice to overload operator^(), IMO.

Definitly. Why isn't the current operator ^ spelled ~ anyway? Then ^
could have the right precedence and meaning. Think of m/s^2. Damn
C-ompatibility ;)

For the abbreviations, I'd put the long names into a namespace (say
'unit') and put the shorter ones into a sub-namespace (say
'abbreviations'. The user can then select whether he wants to enable them:

namespace unit { using abbreviations; }

reads cool, doesn't it :o)

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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at