Boost logo

Boost :

From: Dave Dribin (dave-ml_at_[hidden])
Date: 2005-05-02 12:08:29


On May 1, 2005, at 1:56 PM, Kevlin Henney wrote:
> This issue of providing a default value in case of failure was
> discussed in the early days of lexical_cast, but not included. In
> fact, if you go back far enough, opting for the default or zero
> constructed value of the target rather than throwing an exception was
> the original behaviour.
>
> However, the accommodation of an additional argument was not included
> in lexical_cast in part for the simple reason that it ceases to look
> like a cast and in part because once you start down that road there
> are a number of additional arguments and options that you might want
> that are "reasonable". It was felt that much of this would be better
> off in a general conversions library that had no pretensions to being
> cast-like.

I agree that the default behavior should throw an exception. It just
seems silly to create a whole new library that could be done in an
existing one with about 5 lines of code. And I'd prefer a
multi-argument cast-like function than include yet *another* 3rd party
library with my application. Anyhow, I have an idea or two as
alternatives. If you're interested, lemme know, otherwise I'll drop
the whole idea. :)

-Dave


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