From: Michiel Salters (Michiel.Salters_at_[hidden])
Date: 2001-04-13 06:49:31
> -----Original Message-----
> From: Peter Schmitteckert [mailto:boost_at_[hidden]]
> Sent: Friday, April 13, 2001 12:18 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] arithmetic type wrapper
> > >
> > > meters m = meters (10) + meters (20); //ok
> > >
> > > feet f = feet (5) + feet (10); // ok
> > >
> > > meters (10) + feet (20); // oops, compile-time error
> > Wouldn't it be more useful to define conversions between
> feet and meters?
> And the result type should be ? Living in Europe I would
> always convert
> to SI units. Maybe it would be better to use explicit
> conversion then, e.g.
> meters( feet(20) )
> Best wishes,
Good point, which just goes to show that meters shouldn't be a type.
meter should be a const length.
I.e. length L = 10*meter + 2*feet;
float length_in_inches = L / inch;
How class length stores should be undefined.
You still catch
length L = 10*secs; or length()+time();
IOstream behavior probably needs locales etc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk