Boost logo

Boost :

From: Deane Yang (deane_yang_at_[hidden])
Date: 2004-01-08 15:17:26


Dan W. wrote:
> I'm not sure I understand the need for an absolute reference. Couldn't
> each unit BE its own absolute reference? Inside meters, 1 m == 1; inside
> mm, 1 mm == 1. Conversion functions could be non-class functions:
>
> template< U, V >
> void convert( U&, V ){ assert(0); }
> template <>
> void convert<m,mm>( x,y ){ x = 0.001 * y; }
> template <>
> void convert<mm,m>( x,y ){ x = 1000.0 * y; }
>
> then
> template< typename Z >
> m::operator=( Z z ){ convert( *this, z ); }
>
> Assume we forget about systems, there's not even a need for Celsius to
> know that they are temperatures, as long as they are interconvertible
> with Kelvins. Just my $.015.
>

Amen!


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