Allow non-member bitwise operators #768
Closed
KendallHarter
started this conversation in
Suggestions
Replies: 2 comments
-
Hmm, I can't remember now why I did that. I've removed that restriction in 37cf0bf -- thanks! For comparisons the reason I restricted them to members is because with C++20 (Cpp2-derived) symmetry there's no longer a need to write them as nonmembers. But even there I suppose there could be a motivation to write them as nonmembers in order to get comparisons on a type that doesn't provide them itself -- I'll leave that alone for now but we'll see if it's often needed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This code now works:
Thanks again. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, bitwise operators are required to be member functions (see here) and the generated code results in member functions as well. This is contrary to C++ Core Guideline C.161 which recommends using non-member functions. I've looked around but can't find any motivation for this restriction and it creates situations where unfixable asymmetry exists:
Beta Was this translation helpful? Give feedback.
All reactions