boostorg / leaf

Lightweight Error Augmentation Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leaf should document whether specializing `leaf::match` is allowed

steveire opened this issue · comments

It is possible to specialize match in order to match on properties of error types other than .value.

Consider that this makes it possible to match on the category of a std::error_code, but this should be possible for any user-defined error type:

https://godbolt.org/z/YRXTtZ

It should be documented whether this kind of specialization of matching is allowed.

The match<> api is currently overloaded but I have already changed that in my working branch. Now there will be several separate predicates: match<>, match_value<> (which matches on .value), match_member<> (which can match any data member, but requires C++17).