|
Boost : |
From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-12-15 10:31:45
| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of Walter Landry
| Sent: Monday, December 15, 2003 12:40 PM
| To: boost_at_[hidden]
| Subject: Re: [boost] Re: new compile-time dimensional analysis and
| unitlibrary
|
| Matthias Schabel <boost_at_[hidden]> wrote:
| > It should be clear that radian (length/length) and steradian
| > (area/area) are fundamentally different quantities, even though they
| > are technically both dimensionless numbers.
|
| It is not uncommon to have expressions like sin(theta + theta^2). It
| sure doesn't look clear to me that theta and theta^2 should have
| different units. They should certainly be allowed to mix.
|
This might be what you want, but it may conflict with what dimensional
analysis/checking system is possible in C++.
To achieve this in practice, could you reasonably require the user to cast to
some POD?
sin(static_cast<float>(theta) + static_cast<float>(theta^2) );
Paul
Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
mailto:pbristow_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk