Boost logo

Boost Users :

From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2005-01-29 17:57:20


Terje Slettebų wrote:

> I've brought this thread to Kevlin Henney's attention, as I've tended to
> take care of lexical_cast related questions on the list (including
> forwarding things needing his consideration, such as any changes to
> lexical_cast, to him). I'm replying here to let you know that your report is
> being taken care of.

Many, many thanks!

>>1. lexical_cast(Source arg) takes the source argument by value. Why not
>>by const& ? Calling lexical_cast(some_basic_string) now makes a copy of
>>the source argument for no reason.
>
>
> I heard from Kevlin that the reason was that there originally were some
> issues with binding to string literals. Changing it to use const reference
> in my local copy still gives a lot of error messages, having to do with
> std::numeric_limits being used in the implementation. If we find a way to
> fix this (yet letting it still work on compilers with no class template
> partial specialisation, like MSVC 6), without breaking existing programs,
> then apparently, this change should be ok. If anyone makes a patch for this,
> it would be welcome.

Hmmm, interesting. I'll give it a look. Maybe I'll be lucky enough to
think of something...

>>2. lexical_cast ignores trailing whitespaces, but not leading
>>whitespaces. Meaning that
>>
>>int a = lexical_cast<int>("3 "); // three-space
>>
>>will work and return 3, but
>>
>>int a = lexical_cast<int>(" 3"); // space-three
>>
>>will throw. Why? There's no rationale here. Both cases should be treated
>>in the same manner, and IMHO, that manner should be throwing.
>
>
> In Kevlin's reply to me, he agreed with this. This has been fixed, and will
> likely be committed soon, and a note posted about the update.

Great! Thanks again.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net