On Sun, May 31, 2020 at 10:32 AM Rainer Deyke via Boost < boost@lists.boost.org> wrote:
On 31.05.20 18:03, Christian Mazakas via Boost wrote:
The use of such a low-level API would look something like this:
Hmm, I'm failing to see the overwhelming value in exposing these
portions
of the API.
Here is one use case for some kind of low-level access to error objects without going through lambdas (although it would have a different form than the one used by Bjorn). Suppose I have an error type that may or may not be annotated with a file name, an IP address, or a user name, individually or in any combination. For each of these annotations, I want to handle it the same whenever it is present, regardless of the others. Without some sort of direct access to error objects, the code for this would look something like this:
return leaf::try_handle_some( some_try_block, [](leaf::match
, leaf::e_file_name fname, my::e_user_name uname, my::ip_address ip) { handle_filename(fname); handle_user_name(uname); handle_ip(ip); return handle_error(); },
No, you'd simply do:
return leaf::try_handle_some(
some_try_block,
[](leaf::match