On 6/06/2017 21:23, Niall Douglas wrote:
Also, if you want the TRY operation to work (and you really, really do, it is an enormous boilerplate saver), then your error type needs to be identical throughout your program. Templating it breaks that.
Why does it need to be identical? Can't you just use decltype(r.error())? As long as you know that at minimum it supports the error_code interface this should be sufficient for most purposes.
I am currently minded to have error_code_extended no longer store a 191 byte string which lets me pack many more of them into a reasonably sized ringbuffer. If people want to store a string, I am minded they should be either supplying a static const char * or else return an outcome<T> with shared_ptr payload to strings.
How would they do such a payload for an error case?