Move std::hash specialization to header.

This commit is contained in:
Alexander McCord 2024-05-26 12:04:58 -07:00
parent d13a86be41
commit 11f72000a9
2 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,8 @@
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details // This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
#pragma once #pragma once
#include <functional>
namespace Luau::EqSat namespace Luau::EqSat
{ {
@ -18,3 +20,9 @@ private:
}; };
} // namespace Luau::EqSat } // namespace Luau::EqSat
template<>
struct std::hash<Luau::EqSat::Id>
{
size_t operator()(Luau::EqSat::Id id) const;
};

View file

@ -1,8 +1,6 @@
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details // 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 "Luau/Id.h"
#include <functional>
namespace Luau::EqSat namespace Luau::EqSat
{ {
@ -28,11 +26,7 @@ bool Id::operator!=(Id rhs) const
} // namespace Luau::EqSat } // namespace Luau::EqSat
template<> size_t std::hash<Luau::EqSat::Id>::operator()(Luau::EqSat::Id id) const
struct std::hash<Luau::EqSat::Id>
{
size_t operator()(Luau::EqSat::Id id) const
{ {
return std::hash<size_t>()(size_t(id)); return std::hash<size_t>()(size_t(id));
} }
};