
7 Feb
2009
7 Feb
'09
7:01 a.m.
On Fri, Feb 6, 2009 at 11:02 PM, Vladimir Batov <batov@people.net.au> wrote:
int i = lexical_cast<optional<int> >(mystring).get_value_or(-1);
Why is this so bad?
Well, if you want lexical_cast (and Boost) *not* used in the wide, then keep mounting these wonderful complexities and interfaces. Surely the users will be very supportive of your effort.
Well, that was somewhat terse and unfriendly. Apologies. I'll elaborate and give you metrics.
1. int i = lexical_cast<optional<int> >(mystring).get_value_or(-1);
Please, no.
2. int i = lexical_cast(mystring, -1);
Again, +1 from me. I have the exact same use case, and the same desire as Vladimir. --Michael Fawcett