|
Boost : |
From: Kevlin Henney (kevlin_at_[hidden])
Date: 2001-02-26 02:32:00
In message <01022215243600.04969_at_chronos>, Vladimir Prus
<ghost_at_[hidden]> writes
>Kevlin Henney wrote:
>
>>>At the moment lexical_cast<string>(whatever) will fail if 'whatever'
>decides
>>>to insert spaces in its representation. I think that it is not very
>>>convenient.
>
>>You're right that it's not convenient, but I would hesitate to make
>>std::string a special case.
>
>I really think that making std::string a special case is OK, because:
>1. It will always be a special case, either inside lexical_cast or in user
>code.
I was referring to std::string as a special case of std::basic_string,
but that's something that can be accommodated without a problem, and
also to other string classes. However, in the latter case if the 'API'
is opened up, that offers a hook for extension.
>3. Actually, string's operator>> has no choice but to stop when it encounters
>space, for it has no knowledge what was put in the stream.
Well, it does have a choice, but that's a historical design decision we
can't easily retake :->
>> A more general solution would be to replace the expression
>
>> ... || !(interpreter >> result) || ...
>
>> by
>
>> ... || !interpret(interpreter, result) || ...
>
>Yes, this is shurely better. What are chances that something like this will
>be added?
High :-) When I get a moment I will try to roll this change in with the
proposed floating point mods, plus tests and changes to docs.
Kevlin
____________________________________________________________
Kevlin Henney phone: +44 117 942 2990
Curbralan Limited mobile: +44 7801 073 508
mailto:kevlin_at_[hidden] fax: +44 870 052 2289
http://www.curbralan.com
____________________________________________________________
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk