ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: lexical_cast question
by Vladimir Prus other posts by this author
Feb 22 2001 12:24PM messages near this date
Re: [boost] Status dir_it lib | Re: [boost] Re: lexical_cast question
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.
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
that?

>  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?

--
Regards,
Vladimir
Thread:
Vladimir Prus
Thomas Matelich
Kevlin Henney
Tom Matelich
Larry Evans
Steven Kirk
Kevlin Henney

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved