I’ve
derived a class from error_category to categorize errors associated with my
class. Elsewhere, I want to test to see if an error code I’ve
gotten (from an exception) is one of those, or not. A line like
if
(X.code().category != mycategory) ...
should do
the trick. ‘mycategory’ is the same object used to create
error codes in my class: a single instance of the derived error_category class.
However,
this gives ambiguities in matching the operator.
This makes
it quite unfriendly to use. I have to cast the right-hand-side to the
base class reference, for example.
If I
reversed the arguments, the list of possible matches the compiler mentioned did
not even include the one I wanted.
As this is a
TR2 candidate, I think such rough edges should be examined and avoided.
--John