disable different states comparing

This commit is contained in:
BlackMATov
2023-03-11 22:52:23 +07:00
parent 2866b71e87
commit debecad420
4 changed files with 33 additions and 34 deletions

View File

@@ -398,13 +398,13 @@ namespace std
namespace meta_hpp
{
template < detail::state_family L, detail::state_family R >
[[nodiscard]] bool operator==(const L& l, const R& r) noexcept {
template < detail::state_family State >
[[nodiscard]] bool operator==(const State& l, const State& r) noexcept {
return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_index() == r.get_index());
}
template < detail::state_family L, detail::state_family R >
[[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept {
template < detail::state_family State >
[[nodiscard]] std::strong_ordering operator<=>(const State& l, const State& r) noexcept {
if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) {
return cmp;
}
@@ -414,13 +414,13 @@ namespace meta_hpp
namespace meta_hpp
{
template < detail::state_family L >
[[nodiscard]] bool operator==(const L& l, const typename L::index_type& r) noexcept {
template < detail::state_family State >
[[nodiscard]] bool operator==(const State& l, const typename State::index_type& r) noexcept {
return l.is_valid() && l.get_index() == r;
}
template < detail::state_family L >
[[nodiscard]] std::strong_ordering operator<=>(const L& l, const typename L::index_type& r) noexcept {
template < detail::state_family State >
[[nodiscard]] std::strong_ordering operator<=>(const State& l, const typename State::index_type& r) noexcept {
return l.is_valid() ? l.get_index() <=> r : std::strong_ordering::less;
}
}

View File

@@ -410,13 +410,13 @@ namespace std
namespace meta_hpp
{
template < detail::type_family L, detail::type_family R >
[[nodiscard]] bool operator==(const L& l, const R& r) noexcept {
template < detail::type_family TypeL, detail::type_family TypeR >
[[nodiscard]] bool operator==(const TypeL& l, const TypeR& r) noexcept {
return l.is_valid() == r.is_valid() && (!l.is_valid() || l.get_id() == r.get_id());
}
template < detail::type_family L, detail::type_family R >
[[nodiscard]] std::strong_ordering operator<=>(const L& l, const R& r) noexcept {
template < detail::type_family TypeL, detail::type_family TypeR >
[[nodiscard]] std::strong_ordering operator<=>(const TypeL& l, const TypeR& r) noexcept {
if ( const std::strong_ordering cmp{l.is_valid() <=> r.is_valid()}; cmp != std::strong_ordering::equal ) {
return cmp;
}
@@ -426,13 +426,13 @@ namespace meta_hpp
namespace meta_hpp
{
template < detail::type_family L >
[[nodiscard]] bool operator==(const L& l, const typename L::id_type& r) noexcept {
template < detail::type_family Type >
[[nodiscard]] bool operator==(const Type& l, const typename Type::id_type& r) noexcept {
return l.is_valid() && l.get_id() == r;
}
template < detail::type_family L >
[[nodiscard]] std::strong_ordering operator<=>(const L& l, const typename L::id_type& r) noexcept {
template < detail::type_family Type >
[[nodiscard]] std::strong_ordering operator<=>(const Type& l, const typename Type::id_type& r) noexcept {
return l.is_valid() ? l.get_id() <=> r : std::strong_ordering::less;
}
}