aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Utilities/advstd.h5
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h11
-rw-r--r--src/server/game/DataStores/DB2Stores.h7
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h5
4 files changed, 18 insertions, 10 deletions
diff --git a/src/common/Utilities/advstd.h b/src/common/Utilities/advstd.h
index ff2717c9755..5b9991854bf 100644
--- a/src/common/Utilities/advstd.h
+++ b/src/common/Utilities/advstd.h
@@ -18,9 +18,14 @@
#ifndef TRINITY_ADVSTD_H
#define TRINITY_ADVSTD_H
+#include <compare>
+
// this namespace holds implementations of upcoming stdlib features that our c++ version doesn't have yet
namespace advstd
{
+// libc++ is missing these two
+[[nodiscard]] constexpr bool is_eq(std::partial_ordering cmp) noexcept { return cmp == 0; }
+[[nodiscard]] constexpr bool is_neq(std::partial_ordering cmp) noexcept { return cmp != 0; }
}
#endif
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 31bb3c82161..9406fbedb00 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -21,6 +21,7 @@
#include "Define.h"
#include "ObjectGuid.h"
#include "WaypointDefines.h"
+#include "advstd.h"
#include <limits>
#include <map>
#include <string>
@@ -1645,15 +1646,15 @@ struct SmartScriptHolder
// Default comparision operator using priority field as first ordering field
std::strong_ordering operator<=>(SmartScriptHolder const& right) const
{
- if (auto cmp = priority <=> right.priority; std::is_neq(cmp))
+ if (std::strong_ordering cmp = priority <=> right.priority; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = entryOrGuid <=> right.entryOrGuid; std::is_neq(cmp))
+ if (std::strong_ordering cmp = entryOrGuid <=> right.entryOrGuid; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = source_type <=> right.source_type; std::is_neq(cmp))
+ if (std::strong_ordering cmp = source_type <=> right.source_type; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = event_id <=> right.event_id; std::is_neq(cmp))
+ if (std::strong_ordering cmp = event_id <=> right.event_id; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = link <=> right.link; std::is_neq(cmp))
+ if (std::strong_ordering cmp = link <=> right.link; advstd::is_neq(cmp))
return cmp;
return std::strong_ordering::equal;
}
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 704fc872034..314556b8239 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -22,6 +22,7 @@
#include "DB2Structure.h"
#include "Optional.h"
#include "SharedDefines.h"
+#include "advstd.h"
#include <map>
#include <set>
#include <vector>
@@ -352,11 +353,11 @@ public:
friend std::strong_ordering operator<=>(HotfixRecord const& left, HotfixRecord const& right)
{
- if (auto cmp = left.ID <=> right.ID; std::is_neq(cmp))
+ if (std::strong_ordering cmp = left.ID <=> right.ID; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = left.TableHash <=> right.TableHash; std::is_neq(cmp))
+ if (std::strong_ordering cmp = left.TableHash <=> right.TableHash; advstd::is_neq(cmp))
return cmp;
- if (auto cmp = left.RecordID <=> right.RecordID; std::is_neq(cmp))
+ if (std::strong_ordering cmp = left.RecordID <=> right.RecordID; advstd::is_neq(cmp))
return cmp;
return std::strong_ordering::equal;
}
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index 5affc9b0255..b3a0213436d 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -20,6 +20,7 @@
#include "Define.h"
#include "EnumFlag.h"
+#include "advstd.h"
#include <array>
#include <functional>
#include <list>
@@ -333,9 +334,9 @@ class TC_GAME_API ObjectGuid
bool operator==(ObjectGuid const& right) const = default;
std::strong_ordering operator<=>(ObjectGuid const& right) const
{
- if (std::strong_ordering cmp = _data[1] <=> right._data[1]; std::is_neq(cmp))
+ if (std::strong_ordering cmp = _data[1] <=> right._data[1]; advstd::is_neq(cmp))
return cmp;
- if (std::strong_ordering cmp = _data[0] <=> right._data[0]; std::is_neq(cmp))
+ if (std::strong_ordering cmp = _data[0] <=> right._data[0]; advstd::is_neq(cmp))
return cmp;
return std::strong_ordering::equal;
}