From 7b310802583a96dd32841bc396a119fca833e2d4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 6 Apr 2023 17:46:58 +0200 Subject: Core/Misc: Modernize code a bit by replacing std::tie with either structured bindings or operator<=> --- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/server/game/AI/SmartScripts') diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index d4af11f7dad..475b4ad4ad5 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1643,9 +1643,19 @@ struct SmartScriptHolder operator bool() const { return entryOrGuid != 0; } // Default comparision operator using priority field as first ordering field - bool operator<(SmartScriptHolder const& other) const + std::strong_ordering operator<=>(SmartScriptHolder const& right) const { - return std::tie(priority, entryOrGuid, source_type, event_id, link) < std::tie(other.priority, other.entryOrGuid, other.source_type, other.event_id, other.link); + if (auto cmp = priority <=> right.priority; std::is_neq(cmp)) + return cmp; + if (auto cmp = entryOrGuid <=> right.entryOrGuid; std::is_neq(cmp)) + return cmp; + if (auto cmp = source_type <=> right.source_type; std::is_neq(cmp)) + return cmp; + if (auto cmp = event_id <=> right.event_id; std::is_neq(cmp)) + return cmp; + if (auto cmp = link <=> right.link; std::is_neq(cmp)) + return cmp; + return std::strong_ordering::equal; } static constexpr uint32 DEFAULT_PRIORITY = std::numeric_limits::max(); -- cgit v1.2.3