Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-01-08 15:03:28


I have had a little look into the YANL library (I will have a more in depth
look later), especially the SI units section. The code makes use of tabs
which distorts the alignment of the constants boost::units::si::_ohm, etc.

Regarding possibilities for short names:

   using namespace si;
   typedef typename speed< double >::type Speed;
   Speed s = 2 * m / s; // [1]
   Speed s = 2 * _m / _s; // [2]
   Speed s = 2 * m_ / s_; // [3]

[1] This would be ideal since it is close to the Physics representation (2
m/s; 3.7 m/s[-2]).
[2] This is a possibility, but there is a chance for name collision.
[3] This should minimize name collision, since x_ is less common than _x or
x style names.

BTW: I don't mind using:
   Speed s = 2 * _meter / _second;
but I am thinking of supporting use of the symbolic forms of the various
units so you can get closer to expressing Physics-based equations.

NOTE: you could put the symbols in a namespace, e.g.
boost::units::si::symbols, then the user could choose to adopt them with
   using namespace boost::units::si::symbol;
   // ...
or whatever.

I will give more feedback once I have had a more detailed look at the
library.

NOTE: on the discussions regarding peoples needs and the
advantages/disadvantages of the two libraries available, is it possible to
have both libraries? That way, the user could select whether they want
compile-time performance (using one library) or dimensional analysis (using
another).

I understand there would most likely be code duplication with this approach
and differing interfaces, but is it possible to derive the two from a common
core? I haven't had a chance to look into the implementation details or the
design yet, so I cannot go into more details than this.

Regards,
Reece

_________________________________________________________________
Sign-up for a FREE BT Broadband connection today!
http://www.msn.co.uk/specials/btbroadband


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