remove std::tie comparing

This commit is contained in:
BlackMATov
2022-01-07 19:56:35 +07:00
parent 0dc88b7249
commit 495e149e57
2 changed files with 15 additions and 15 deletions

View File

@@ -601,11 +601,11 @@ namespace meta_hpp
, name{std::move(name)} {}
[[nodiscard]] friend bool operator<(const evalue_index& l, const evalue_index& r) noexcept {
return std::tie(l.type, l.name) < std::tie(r.type, r.name);
return (l.type < r.type) || (l.type == r.type && l.name < r.name);
}
[[nodiscard]] friend bool operator==(const evalue_index& l, const evalue_index& r) noexcept {
return std::tie(l.type, l.name) == std::tie(r.type, r.name);
return l.type == r.type && l.name == r.name;
}
};
@@ -618,11 +618,11 @@ namespace meta_hpp
, name{std::move(name)} {}
[[nodiscard]] friend bool operator<(const function_index& l, const function_index& r) noexcept {
return std::tie(l.type, l.name) < std::tie(r.type, r.name);
return (l.type < r.type) || (l.type == r.type && l.name < r.name);
}
[[nodiscard]] friend bool operator==(const function_index& l, const function_index& r) noexcept {
return std::tie(l.type, l.name) == std::tie(r.type, r.name);
return l.type == r.type && l.name == r.name;
}
};
@@ -635,11 +635,11 @@ namespace meta_hpp
, name{std::move(name)} {}
[[nodiscard]] friend bool operator<(const member_index& l, const member_index& r) noexcept {
return std::tie(l.type, l.name) < std::tie(r.type, r.name);
return (l.type < r.type) || (l.type == r.type && l.name < r.name);
}
[[nodiscard]] friend bool operator==(const member_index& l, const member_index& r) noexcept {
return std::tie(l.type, l.name) == std::tie(r.type, r.name);
return l.type == r.type && l.name == r.name;
}
};
@@ -652,11 +652,11 @@ namespace meta_hpp
, name{std::move(name)} {}
[[nodiscard]] friend bool operator<(const method_index& l, const method_index& r) noexcept {
return std::tie(l.type, l.name) < std::tie(r.type, r.name);
return (l.type < r.type) || (l.type == r.type && l.name < r.name);
}
[[nodiscard]] friend bool operator==(const method_index& l, const method_index& r) noexcept {
return std::tie(l.type, l.name) == std::tie(r.type, r.name);
return l.type == r.type && l.name == r.name;
}
};
@@ -684,11 +684,11 @@ namespace meta_hpp
, name{std::move(name)} {}
[[nodiscard]] friend bool operator<(const variable_index& l, const variable_index& r) noexcept {
return std::tie(l.type, l.name) < std::tie(r.type, r.name);
return (l.type < r.type) || (l.type == r.type && l.name < r.name);
}
[[nodiscard]] friend bool operator==(const variable_index& l, const variable_index& r) noexcept {
return std::tie(l.type, l.name) == std::tie(r.type, r.name);
return l.type == r.type && l.name == r.name;
}
};
}

View File

@@ -40,12 +40,12 @@ namespace
int ivec2::move_ctor_counter{0};
int ivec2::copy_ctor_counter{0};
bool operator<(const ivec2& l, const ivec2& r) noexcept {
return std::tie(l.x, l.y) < std::tie(r.x, r.y);
[[maybe_unused]] bool operator<(const ivec2& l, const ivec2& r) noexcept {
return (l.x < r.x) || (l.x == r.x && l.y < r.y);
}
bool operator==(const ivec2& l, const ivec2& r) noexcept {
return std::tie(l.x, l.y) == std::tie(r.x, r.y);
[[maybe_unused]] bool operator==(const ivec2& l, const ivec2& r) noexcept {
return l.x == r.x && l.y == r.y;
}
}
@@ -303,7 +303,7 @@ TEST_CASE("meta/meta_utilities/value") {
class empty_class1 {};
class empty_class2 {};
CHECK(operator<(meta::value{empty_class1{}}, meta::value{empty_class2{}}));
CHECK((operator<(meta::value{empty_class1{}}, meta::value{empty_class2{}}) || operator<(meta::value{empty_class2{}}, meta::value{empty_class1{}})));
CHECK_THROWS(std::ignore = operator<(meta::value{empty_class1{}}, meta::value{empty_class1{}}));
}
}