GeezerVison is showing github.com — C++20 now considers equality to be commutable (A == B) === (B == A) · andreasmolander/AliceO2@cb1c668
File tree
Expand file treeCollapse file tree
Open diff view settings
DataFormats/Headers/include/Headers
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Algorithm/test/pageparser.cxx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ struct ClusterData { |
50 | 50 | { |
51 | 51 | } |
52 | 52 |
|
53 | | - bool operator==(const ClusterData& rhs) |
| 53 | + bool operator==(const ClusterData& rhs) const |
54 | 54 | { |
55 | 55 | return clusterid == rhs.clusterid && x == rhs.x && y == rhs.y && z == rhs.z && e == rhs.e; |
56 | 56 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: DataFormats/Headers/include/Headers/DataHeader.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -286,6 +286,8 @@ struct Descriptor { |
286 | 286 | bool operator<(const Descriptor& other) const { return std::memcmp(this->str, other.str, N) < 0; } |
287 | 287 | bool operator!=(const Descriptor& other) const { return not this->operator==(other); } |
288 | 288 |
|
| 289 | + // Convesion operators for comparison with their implicitly convertible types |
| 290 | + friend bool operator==(const Descriptor& lhs, ImplicitConversion rhs) { return static_cast<ImplicitConversion>(lhs) == rhs; } |
289 | 291 | // explicitly forbid comparison with e.g. const char* strings |
290 | 292 | // use: value == Descriptor<N>("DESC") for the appropriate |
291 | 293 | // template instantiation instead |
|
Collapse file
Copy file name to clipboardExpand all lines: Framework/Core/test/test_ASoA.cxx +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -147,10 +147,10 @@ TEST_CASE("TestTableIteration") |
147 | 147 |
|
148 | 148 | b = tests2.begin(); |
149 | 149 | REQUIRE(b != e); |
150 | | - REQUIRE((b + 1) == (b + 1)); |
151 | | - REQUIRE((b + 7) != b); |
152 | | - REQUIRE((b + 7) != e); |
153 | | - REQUIRE((b + 8) == e); |
| 150 | + REQUIRE(((b + 1) == (b + 1))); |
| 151 | + REQUIRE(((b + 7) != b)); |
| 152 | + REQUIRE(((b + 7) != e)); |
| 153 | + REQUIRE(((b + 8) == e)); |
154 | 154 |
|
155 | 155 | for (auto& t : tests2) { |
156 | 156 | REQUIRE(t.x() == value / 4); |
|