Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2000-01-03 11:38:53


> I recommend we add it to boost. There is only one change I would like -- it
> would be nice in some cases to have stream_cast throw an exception instead
> of returning T(). Taking an example from the documentation, stream_cast is
> used to translate the command-line parameters to shorts; but if one of them
> is not translatable, short() is returned, which holds an unspecified yet
> valid value. If an exception was thrown instead, we would be able to know
> if the parameters were all valid shorts or not. Maybe we could add another
> function - stream_cast_throw?

I agree with the above, but one correction is in order.

The result of short() is not an unspecified value. It's the same as
short(0). The short is default initialized which in the case of an integral
type is the same as zero initializing it.

    -- Darin


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