Boost logo

Boost :

From: Tom Matelich (toms-mailing-lists_at_[hidden])
Date: 2001-09-27 14:20:27


--- In boost_at_y..., Kevlin Henney <kevlin_at_c...> wrote:
> In message <01022215243600.04969_at_chronos>, Vladimir Prus
> <ghost_at_c...> 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

Have you gotten anywhere on this Kevlin? I got bit by passing in an
empty string yesterday and it really made me wish for a string to
string specialization (overload?).


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