
Yuval Ronen wrote:
David Abrahams wrote:
optional<T> string_to<T>(x)
FWIW, I like to_string()/string_to() A LOT more than lexical_cast<>. IMO all of the deficiencies of lexical_cast<> are becasue it supposedly pretends to do much more than it actually does in practice. That is, it's definition is too general (convert anything to anything via a stream) while in practice is used mostly (if not exclusively) for to/from string conversions. IMO to_string/string_to allows the semantics of these functions to be narrowed down amd focused in a way that permits implementations to fullfill the most important requirements: closure (round_tripping), efficiency and robustness (optional result in the string_to case).
Yes, looks good. What is the status of optional<T> w.r.t to the standard, anyway? I hope it's on its way...
It was proposed for the Mont Tremblant meetting and it was generally well recieved. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1878.htm Unfortunately, one of the critical issues raised during the meeting, the semantics of asignment of optional references, still needs to be properly addressed, so there is no updated revision yet. -- Fernando Cacciola SciSoft http://fcacciola.50webs.com/