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: [boost] Re: lexical_cast question
by Kevlin Henney other posts by this author
Feb 26 2001 7:32AM messages near this date
Re: [boost] Re: lexical_cast question | Re: lexical_cast question
In message <01022215243600.04969@[...]..> , Vladimir Prus
<ghost@[...]..>  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@[...].. fax: +44 870 052 2289
 http://www.curbralan.com
____________________________________________________________
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