Automated Equality Checks in C++ with Reflection (C++26)
10 points by raymii
10 points by raymii
But why?
You can already get member-wise equality by defaulting the comparison operator. As the article points out, this requires that all members already have equality themselves, but that's a good thing: You cannot write a comparison operator without knowing what the type does: what do you do with pointers? His code has a bunch of heuristics about the type to special case ranges and stuff, but that are just that - heuristics. You can easily come up with types that don't match his heuristics and would be compared in the wrong way. It just seems like a footgun.