On 12 Nov 2016 at 14:10, Klemens Morgenstern wrote:
Ok, I did miss the match, call, but that's basically to get the error out of the outcome. I meant the other way around: let outcome automatically capture the errors of the ctor automatically. I've tried to put together an example, but I failed to get it right with the parameter forwarding, so that (https://godbolt.org/g/UdKzFs) doesn't work properly. I'm not sure if there is a good solution for that, but it hopefully demonstrates what I'm talking about. But since it's not as easy as I hoped, it maybe should not be part of outcome, but rather a wrapper holding one. On the other hand, having a solution that at least works with ctors, seems important to me, since you could have RAII with that while disabling exceptions.
I think the code you show in godbolt would make an excellent free function helper e.g. make_outcome_nothrow<T>(Args...). I'm not keen on adding to the emplacement constructor as that adds to all monad construction costs whether you use the facility or not. I've added the free function as a todo, it'll be in the presented Outcome next Spring. Thanks for the idea Klemens. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/