From: vladimir josef sykora (vladimir.sykora_at_[hidden])
Date: 2002-10-16 11:57:58
I've been working for some time now on a physical unit's library that I'd
like to submit to boost. It uses the concept of generating units out of
physical dimensions. It provides type-safety and implicit conversion between
units using operators.
The unit's dimension orders are static constant integers and are calculated
on compile-time (using mpl); however, the conversion between the unit's
values are calculated on run time. The coversion between pure units is
policy-driven and is easy to add more pure-units to the policies.
The library compiles on gcc 3.2. Still has some nasty behavior on Borland
(the ices are buried deep inside templated code).
I'd like to hear if there's any interest in the library. I think it'll fit
great with a physical constants library. I've uploaded the zip file here:
Here's an example of the syntax for creating unit's types:
using namespace morpho;
typedef unit<double, some_unit_tl> some_unit_t;
typedef unit<double, some_other_unit_tl> some_other_unit_t;
product_result_t; // converts to the lhs policies and value_type
int main(int argc, char* argv)
std::cout << product_res << std::endl;
20 s^-2 kg^2 m^3
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk