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>
This commit is contained in:
Corentin Wallez
2020-06-18 09:00:48 +00:00
committed by Commit Bot service account
parent a84ab48150
commit 581c407cd2
2 changed files with 8 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
#define COMMON_HASHUTILS_H_
#include "common/Platform.h"
#include "common/TypedInteger.h"
#include <bitset>
#include <functional>
@@ -27,6 +28,12 @@ size_t Hash(const T& value) {
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.
//