
5 Mar
2007
5 Mar
'07
9:56 p.m.
AMDG Matthias Schabel <boost <at> schabel-family.org> writes:
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;
gives
3
But they cannot be found by ADL and they return the raw value_type. The preferable output from your example would be 3 dimensionless In Christ, Steven Watanabe