Boost logo

Boost :

From: Gerhard Wesp (gwesp_at_[hidden])
Date: 2006-06-08 12:37:24


On Wed, Jun 07, 2006 at 09:39:25PM +0000, Leland Brown wrote:
> force unit. I prefer requiring:
>
> force f = 10.0 * kilogram; // error will be caught by compiler!

Seems like a classic case for explicit constructors. I actually thought
about this but didn't mention in my posting. I'm perfectly fine with
using them, so if you really need the conversion from double you can
write (you do; to avoid a chicken-and-egg problem!):

  const length meter(1);

force f = 10; would then be illegal.

Regards
-Gerhard

-- 
Gerhard Wesp
ZRH office voice: +41 (0)44 668 1878
ZRH office fax: +41 (0)44 200 1818
For the rest I claim that raw pointers must be abolished.

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