This change plumbs an equality function object type through the quiche linked hash map type. This will enable future changes to the hashing behavior of SpdyHeaderBlock.
gfe-relnote: Adds a class template parameter with an appropriate default. No functional change intended.
PiperOrigin-RevId: 287990478
Change-Id: Icd72f36561fc31f2f7092306b960e4d8721aa774
diff --git a/common/simple_linked_hash_map.h b/common/simple_linked_hash_map.h
index b7488eb..6eb6ed9 100644
--- a/common/simple_linked_hash_map.h
+++ b/common/simple_linked_hash_map.h
@@ -16,6 +16,7 @@
#ifndef QUICHE_COMMON_SIMPLE_LINKED_HASH_MAP_H_
#define QUICHE_COMMON_SIMPLE_LINKED_HASH_MAP_H_
+#include <functional>
#include <list>
#include <tuple>
#include <type_traits>
@@ -33,11 +34,15 @@
// We also keep a set<list::iterator> for find. Since std::list is a
// doubly-linked list, the iterators should remain stable.
-template <class Key, class Value, class Hash = std::hash<Key>>
+template <class Key,
+ class Value,
+ class Hash = std::hash<Key>,
+ class Eq = std::equal_to<Key>>
class SimpleLinkedHashMap {
private:
typedef std::list<std::pair<Key, Value>> ListType;
- typedef QuicheUnorderedMap<Key, typename ListType::iterator, Hash> MapType;
+ typedef QuicheUnorderedMap<Key, typename ListType::iterator, Hash, Eq>
+ MapType;
public:
typedef typename ListType::iterator iterator;