3 ms·
From the first comment on the page: "The non-member function operator overloads that return bitmask<option_type> will not be considered for overload resolution
by elteto 8y ago
From the first comment on the page:
"The non-member function operator overloads that return bitmask<option_type> will not be considered for overload resolution if the enums are in a different namespace than the bitmask definition. The template deduction of operator| would not be sufficient since it does not trigger ADL from outside the namespace -- the overload must be available from within the scope where it used. This effectively requires a using directive or declaration to make them visible to participate in resolution (and at which, this will attempt to participate in resolution of any enum type where it may be considered a better match)."
Is this correct? Because if it is, C++ is bonkers...
- MaxBarraclough 8y agoDeep dark arcane corner-cases in C++? Say it ain't so!
- simias 8y agoC++ ADL is pretty bonkers indeed, or at least somewhat surprising if you don't know the rules very well. Thing is without ADL some patterns would be a lot harder to write (or use). I personally dislike overloading very much so I'm probably not the best person to defend it though.