From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-02-22 07:24:36
Kevlin Henney wrote:
>>At the moment lexical_cast<string>(whatever) will fail if 'whatever'
>>to insert spaces in its representation. I think that it is not very
>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
2. Change will add functionality, and is *very* unlikely to break anything.
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. lexical_cast knows
that exactly one object was put there, so why should we pretend we don't know
> A more general solution would be to replace the expression
> ... || !(interpreter >> result) || ...
> ... || !interpret(interpreter, result) || ...
Yes, this is shurely better. What are chances that something like this will
-- Regards, Vladimir
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk