From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-12-30 17:53:48
>From: "Early Ehlinger" <earlye_at_[hidden]>
> This is an interesting argument. In other words, lexical_cast is, by
> definition, conversion through a stream. Therefore, one cannot expect a
> string with whitespace to exit as it went in.
Not a string that uses whitespace as termination, no. However, that also
means that you can't lexical_cast convert any type that has whitespace in
its stream output, to std::string, which could make it rather less useful.
This is the current situation.
Note that it doesn't end there:
std::string str=boost::lexical_cast<std::string>(""); // Throws
Shouldn't this be allowed, either? This is also a case that has resulted in
problem-reports for the current version. This is fixed in the proposal, and
the fix for both whitespace and empty strings can work the same way:
interpreter << source;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk