Boost logo

Boost :

From: Thomas Matelich (matelich_at_[hidden])
Date: 2005-08-09 08:00:27


On 8/9/05, Yuval Ronen <ronen_yuval_at_[hidden]> wrote:
> Thomas Matelich wrote:
> >
> > You'll note that stream >> std::ws is no longer called.
> >
> > One note that I must make is that I do not have the vanilla source for
> > lexical_cast. From the last time lexical_cast broke my source, I've
> > commented out stream.unsetf(std::ios::skipws); in the lexical_stream
> > constructor (see
> > http://lists.boost.org/MailArchives/boost-users/msg03656.php for the
> > reason).
> >
> > I just recalled a unit test we have that would expose the problem (and
> > it did). By adding a [stream >> std::ws &&] before the check for eof,
> > my problem was resolved. Is there a reason we want to fail with
> > trailing whitespace?
>
> I'm not the lexical_cast author, but I do know there were discussions
> about this in the Boost mailing lists (search the archives, one of these
> threads was started by me). The reason for changing it was symmetry. In
> Boost 1.32, trailing whitespaces were ignored, while leading whitespaces
> were not. This is clearly wrong because there's no reason for asymmetry
> here. So the decision (which I'm fully agree with, BTW) is to *not*
> ignore whitespaces at all.
>
> If you want to ignore whitespaces, then the (simple) suggestion I can
> give you is to trim (the string_algo Boost library) the string before
> sending it to lexical_cast.

Why do these changes always get made when I'm taking a break from the
list? Oh well, I didn't see the value in the first change, and I
don't see the value in this change. I'll add another item to my
"Things to do to new Boost versions before committing" list.

Thanks for the answer.

Tom


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