
My memory on this is quite blurred, but long time ago Terje Slettebo did a complete rewrite of lexical_cast<>, in this direction (I haven't looked at your code though). I forwarded your message to Terje. My solution is not a complete rewrite. Some source types are routed to lexical_stream_limited. It doesn't have stringstream member but rather a pointer to local buffer (those source types are always
Gennaro Prota wrote: limited in length). I use custom algorithms to place a source value to the buffer because it's faster. Though, I could use streambuf and ostream to format to the buffer without additional allocations. I use streambuf and istream for input phase except wstring and string types (it's not different from old lexical_stream) and CharT. All other target types are read using istream and streambuf that points to the buffer.
In the end, however, the current solution was preferred, I guess for its simplicity. That doesn't mean you cannot have another take at it, but I'd suggest to search for old posts and ask what the current consensus is before investing time on it. I'm waiting for a reply from Terje.
-- Alexander Nasonov Project Manager at Akmosoft ( http://www.akmosoft.com ) Blog: http://nasonov.blogspot.com Email: $(FirstName) dot $(LastName) at gmail dot com