Fix TypedInteger hash compilation failure with stdlibc++

TypedInteger.h didn't include <functional> which made the reference to
std::hash cause a compilation failure. Fix this by moving TypedInteger
hashing to HashUtils.h so that TypedInteger doesn't include <functional>
in all of its users.

Bug: dawn:442
Change-Id: I5a0271bb187682616eb5ef3a13bb7f6271203453
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23440
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/common/HashUtils.h b/src/common/HashUtils.h
index c42b60e..a316dbc 100644
--- a/src/common/HashUtils.h
+++ b/src/common/HashUtils.h
@@ -16,6 +16,7 @@
 #define COMMON_HASHUTILS_H_
 
 #include "common/Platform.h"
+#include "common/TypedInteger.h"
 
 #include <bitset>
 #include <functional>
@@ -27,6 +28,12 @@
     return std::hash<T>()(value);
 }
 
+// Add hashing of TypedIntegers
+template <typename Tag, typename T>
+size_t Hash(const TypedInteger<Tag, T>& value) {
+    return Hash(static_cast<T>(value));
+}
+
 // When hashing sparse structures we want to iteratively build a hash value with only parts of the
 // data. HashCombine "hashes" together an existing hash and hashable values.
 //
diff --git a/src/common/TypedInteger.h b/src/common/TypedInteger.h
index 05450ec..dd06331 100644
--- a/src/common/TypedInteger.h
+++ b/src/common/TypedInteger.h
@@ -193,6 +193,7 @@
 }  // namespace detail
 
 namespace std {
+
     template <typename Tag, typename T>
     class numeric_limits<detail::TypedIntegerImpl<Tag, T>> : public numeric_limits<T> {
       public:
@@ -204,14 +205,6 @@
         }
     };
 
-    template <typename Tag, typename T>
-    class hash<detail::TypedIntegerImpl<Tag, T>> : private hash<T> {
-      public:
-        size_t operator()(detail::TypedIntegerImpl<Tag, T> value) const {
-            return hash<T>::operator()(static_cast<T>(value));
-        }
-    };
-
 }  // namespace std
 
 #endif  // COMMON_TYPEDINTEGER_H_