Gabriel B. has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/67664?usp=email )

Change subject: base: stl_hlp::unordered_{map,set} with stl_hlp::hash by default
......................................................................

base: stl_hlp::unordered_{map,set} with stl_hlp::hash by default

Change-Id: Iad01d7fa6ff6293a2d931ba796666ad3550c6e44
---
M src/base/stl_helpers.hh
1 file changed, 31 insertions(+), 0 deletions(-)



diff --git a/src/base/stl_helpers.hh b/src/base/stl_helpers.hh
index 07aceb1..f14f109 100644
--- a/src/base/stl_helpers.hh
+++ b/src/base/stl_helpers.hh
@@ -33,6 +33,8 @@
 #include <iostream>
 #include <numeric>
 #include <type_traits>
+#include <unordered_map>
+#include <unordered_set>
 #include <vector>

 #include "base/compiler.hh"
@@ -181,6 +183,26 @@
 using hash_impl::hash_value;
 using hash_impl::is_hash_enabled;

+/*
+ * Provide unordered_map and unordered_set with stl_helpers::hash functions. + * These aliases enable clean use of stl_helpers::hash as default Hash template
+ * parameter.
+ */
+template<
+    typename Key,
+    typename T,
+    typename Hash = hash<Key>,
+    typename KeyEqual = std::equal_to<Key>,
+    typename Allocator = std::allocator< std::pair<const Key, T> >>
+using unordered_map = std::unordered_map<Key, T, Hash, KeyEqual, Allocator>;
+
+template<
+    typename Key,
+    typename Hash = hash<Key>,
+    typename KeyEqual = std::equal_to<Key>,
+    typename Allocator = std::allocator<Key>>
+using unordered_set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;
+
 } // namespace stl_helpers
 } // namespace gem5


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/67664?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Iad01d7fa6ff6293a2d931ba796666ad3550c6e44
Gerrit-Change-Number: 67664
Gerrit-PatchSet: 1
Gerrit-Owner: Gabriel B. <gabriel.bus...@arteris.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to