utils: Add HASH template parameter to UniqueVector
Defaults to std::hash.
Change-Id: I99cc545ce8651f9e4f92fc5ba3f1ffdb3f5de289
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60208
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/utils/unique_vector.h b/src/utils/unique_vector.h
index e8359fc..1ae751a 100644
--- a/src/utils/unique_vector.h
+++ b/src/utils/unique_vector.h
@@ -22,7 +22,7 @@
/// UniqueVector is an ordered container that only contains unique items.
/// Attempting to add a duplicate is a no-op.
-template <typename T>
+template <typename T, typename HASH = std::hash<T>>
struct UniqueVector {
/// The iterator returned by begin() and end()
using ConstIterator = typename std::vector<T>::const_iterator;
@@ -55,7 +55,7 @@
private:
std::vector<T> vector;
- std::unordered_set<T> set;
+ std::unordered_set<T, HASH> set;
};
} // namespace tint