From: "Yuval Ronen"
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
then apparently, this change should be ok. If anyone makes a patch for
Thanks, yourself. :) Feedback is always welcome (regardless who's library it is); it's an opportunity to improve it. programs, this,
it would be welcome.
Hmmm, interesting. I'll give it a look. Maybe I'll be lucky enough to think of something...
I've been looking at this, as well, and after trying one approach (doing a
compile-time switch to select between the ordinary, and a "dummy"
std::numeric_limits (if the source type is an array)), I bumped into another
problem: the specialisations for wchar_t, which assumes "const wchar_t *",
not "const wchar_t[...]". This might again be fixed, using partial
specialisation, to work with array, but another approach could be to "go
back to square one" and do the array-to-pointer decay "manually":
template