12 Dec
2013
12 Dec
'13
2:24 p.m.
Krzysztof Czainski wrote:
Whether this or try_lexical_cast, I prefer the function to return an optional.
As I said, it's appealing, but I suspect that it will prove much less convenient in practice. struct X { int a; int b; }; bool parse( X& x, std::string a, std::string b ) { return try_lexical_cast( a, x.a ) && try_lexical_cast( b, x.b ); }