From 11f72000a9c3e4f19dee22dfe8464f871716ca6d Mon Sep 17 00:00:00 2001 From: Alexander McCord Date: Sun, 26 May 2024 12:04:58 -0700 Subject: [PATCH] Move std::hash specialization to header. --- EqSat/include/Luau/Id.h | 8 ++++++++ EqSat/src/Id.cpp | 12 +++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/EqSat/include/Luau/Id.h b/EqSat/include/Luau/Id.h index 15d46d84..13de424f 100644 --- a/EqSat/include/Luau/Id.h +++ b/EqSat/include/Luau/Id.h @@ -1,6 +1,8 @@ // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #pragma once +#include + namespace Luau::EqSat { @@ -18,3 +20,9 @@ private: }; } // namespace Luau::EqSat + +template<> +struct std::hash +{ + size_t operator()(Luau::EqSat::Id id) const; +}; diff --git a/EqSat/src/Id.cpp b/EqSat/src/Id.cpp index e8f2b63e..960249ba 100644 --- a/EqSat/src/Id.cpp +++ b/EqSat/src/Id.cpp @@ -1,8 +1,6 @@ // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #include "Luau/Id.h" -#include - namespace Luau::EqSat { @@ -28,11 +26,7 @@ bool Id::operator!=(Id rhs) const } // namespace Luau::EqSat -template<> -struct std::hash +size_t std::hash::operator()(Luau::EqSat::Id id) const { - size_t operator()(Luau::EqSat::Id id) const - { - return std::hash()(size_t(id)); - } -}; + return std::hash()(size_t(id)); +}