|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-05-31 17:55:29
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<my_error>,
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk