Boost logo

Boost :

From: Matthias Schabel (boost_at_[hidden])
Date: 2007-03-05 16:36:56

>> a) It might be handy, though, to have (for example) a log function
>> that enforces unitless quantities. For example,
>> log ( velocity * time / meters )
>> is fine, but if you forget to multiply by the time, you get a
>> helpful error message.

Cases where the function argument reduces to a dimensionless quantity
already all work because dimensionless quantities can be implicitly
converted to their value type :

std::cout << std::sqrt(quantity<SI::velocity>
(9.0*SI::meters_per_second)*SI::seconds/SI::meters) << std::endl;



>> b) It might also be handy, if possible, to have some functions that
>> take units and know what to do; for example, sqrt (m*m) properly
>> returns meters, and so forth.

True - we can support integral and rational powers, but not irrational


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