Skip to content

Commit 216c67b

Browse files
committed
Make NodeArray monostate (not dependent on child relops)
1 parent f97669a commit 216c67b

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

include/iris/compare.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ constexpr auto synth_three_way = []<class T, class U>(T const& t, U const& u) //
5151
{ u < t } -> req::boolean_testable;
5252
}
5353
{
54-
if constexpr (requires { t <=> u; } /*std::three_way_comparable_with<T, U>*/) {
54+
if constexpr (std::three_way_comparable_with<T, U>) {
55+
//if constexpr (requires { t <=> u; }) {
5556
return t <=> u;
5657
} else {
5758
if (t < u) return std::weak_ordering::less;

test/rvariant/truly_recursive_test.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,37 @@ struct NodeArray
149149

150150
bool operator==(NodeArray const& other) const
151151
{
152-
return nodes == other.nodes;
152+
return true;
153+
}
154+
155+
bool operator!=(NodeArray const& other) const
156+
{
157+
return false;
153158
}
154159

155160
bool operator<(NodeArray const& other) const
156161
{
157-
return nodes < other.nodes;
162+
return false;
163+
}
164+
165+
bool operator<=(NodeArray const& other) const
166+
{
167+
return true;
168+
}
169+
170+
bool operator>(NodeArray const& other) const
171+
{
172+
return false;
173+
}
174+
175+
bool operator>=(NodeArray const& other) const
176+
{
177+
return true;
158178
}
159179

160-
auto operator<=>(NodeArray const& other) const
180+
std::strong_ordering operator<=>(NodeArray const& other) const
161181
{
162-
return nodes <=> other.nodes;
182+
return std::strong_ordering::equivalent;
163183
}
164184
};
165185

0 commit comments

Comments
 (0)