On Sun, May 31, 2020 at 6:51 AM Bjorn Reese via Boost
I made a typo above. I meant to say std::get<I>.
I am asking for a low-level API, not a bullet-proof API. If the latter is needed, then your existing pattern matching solution works just fine.
The use of such a low-level API would look something like this:
leaf::context
ctx; ctx.activate(); // I would like to avoid this though auto ret = foo(); if (!ret) { switch (ctx.index(ret.error())) { case 0: // E0 handle_E0(ctx.get<0>(ret.error()); break;
case 1: // E1 handle_E1(ctx.get<1>(ret.error()); break;
default: // Unknown error type panic(); break; } }
I think you're essentially asking for access to this function, through slightly different interface: https://github.com/zajo/leaf/blob/develop/include/boost/leaf/handle_error.hp... .