From: Ed Brey (brey_at_[hidden])
Date: 2000-06-05 15:09:00
From: "Ed Brey" <brey_at_[hidden]>
which needs to parse the string twice.
> There is a cost to having more choices, and so the benefit of having
> nothrowing version would have to be at least as high.
One other thought to keep in mind is that stream_cast is just a
convenience function, so it doesn't have to be as flexible as the
baseline interface that it wraps. Stream_cast's return value of the
result type inherently prevent it from providing a comprehensive error
result. What it comes down to is that the stream_cast interface just
is just too small to really address the problem it sets out to solve
unless it uses exceptions. atof had to fall back on 0.0 because there
wasn't a good alternative at the time. Fortunately, with stream_cast,
we have more power now, so we can either throw on error, or if
throwing is not desired, use stringstream directly, which when you're
manually checking for errors, isn't much different than what a
nonthrowing stream_cast would look like:
ss >> d;
// Do something else...
Given that with either exceptions or stringstream, we get rock-solid
interfaces, I think we should take advantage of that and not allow
stream_cast to open up a hole.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk