Rainer Deyke wrote:
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, ...
I think that you can match by pointer here:
leaf::e_file_name * fname,
which will give you nullptr if the file name isn't present.