Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-05 16:56:06


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


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