Don't use <=>. Sigh.

This commit is contained in:
David Given
2022-03-25 22:10:27 +01:00
parent 45f2d98f3c
commit 606d1012d3
2 changed files with 13 additions and 23 deletions

View File

@@ -19,12 +19,20 @@ struct Location
unsigned head;
unsigned groupSize;
std::strong_ordering operator<=>(const Location& other) const
bool operator==(const Location& other) const
{
if (physicalTrack == other.physicalTrack)
return true;
return head == other.head;
}
bool operator<(const Location& other) const
{
auto i = physicalTrack <=> other.physicalTrack;
if (i == std::strong_ordering::equal)
i = head <=> other.head;
return i;
if (physicalTrack < other.physicalTrack)
return true;
if (physicalTrack == other.physicalTrack)
return head < other.head;
return false;
}
};

View File

@@ -1,20 +1,6 @@
#ifndef GLOBALS_H
#define GLOBALS_H
#if defined(_MSVC_LANG)
#define CPP_VERSION _MSVC_LANG
#else
#define CPP_VERSION __cplusplus
#endif
#define CPP20_PRESENT (CPP_VERSION >= 202002L)
#if defined(__cpp_impl_three_way_comparison) && defined(__cpp_lib_three_way_comparison)
#define CPP20_COMPARISONS_PRESENT ((__cpp_impl_three_way_comparison >= 201907L) && (__cpp_lib_three_way_comparison >= 201907L))
#else
#define CPP20_COMPARISONS_PRESENT CPP20_PRESENT
#endif
#include <stddef.h>
#include <functional>
#include <numeric>
@@ -30,10 +16,6 @@
#include <variant>
#include <optional>
#if CPP20_COMPARISONS_PRESENT
#include <compare>
#endif
#if defined(_WIN32) || defined(__WIN32__)
#include <direct.h>
#define mkdir(A, B) _mkdir(A)