On 12/12/2013 19:45, Quoth Michael Caisse:
On 12/11/2013 10:34 PM, Gavin Lambert wrote:
Also having to specify both types is more annoying than in the bool form, where the compiler can infer the parameters.
You still just write:
out1 = try_lexical_cast<T1>(in1)
where the type of out1 is optional<T1> and the type of in1 is deduced.
I thought that ought to work, but I wrote a toy example and it didn't, which is why I phrased it like that. Thinking back on it now I realise what the problem was: On 12/12/2013 18:41, Quoth Peter Dimov:
Antony Polukhin wrote:
And if yes, what signature is preffered:
bool try_lexical_cast
(Out&, const In&) bool try_lexical_cast (const In&, Out&) boost::optional<Out> try_lexical_cast (const In&) bool try_lexical_cast
(const In&, Out&), I'd say.
Inference requires the