]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/base/LookupTable.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / base / LookupTable.h
index 4803644be028c7879c6c40c210e60a0133140afd..2cf6023e6783ed87543a139f374f85f54fa37d24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -9,9 +9,10 @@
 #ifndef SQUID_LOOKUPTABLE_H_
 #define SQUID_LOOKUPTABLE_H_
 
-#include "SBuf.h"
+#include "sbuf/Algorithms.h"
+#include "sbuf/SBuf.h"
 
-#include <map>
+#include <unordered_map>
 
 /**
  * a record in the initializer list for a LookupTable
@@ -46,14 +47,7 @@ struct LookupTableRecord
  *
  */
 
-class SBufCaseInsensitiveLess : public std::binary_function<SBuf, SBuf, bool> {
-public:
-    bool operator() (const SBuf &x, const SBuf &y) const {
-        return x.caseCmp(y) < 0;
-    }
-};
-
-template<typename EnumType, typename RecordType = LookupTableRecord<EnumType> >
+template<typename EnumType, typename RecordType = LookupTableRecord<EnumType>, typename Hasher = CaseInsensitiveSBufHash >
 class LookupTable
 {
 public:
@@ -76,7 +70,7 @@ public:
     }
 
 private:
-    typedef std::map<const SBuf, EnumType, SBufCaseInsensitiveLess> lookupTable_t;
+    typedef std::unordered_map<const SBuf, EnumType, Hasher> lookupTable_t;
     lookupTable_t lookupTable;
     EnumType invalidValue;
 };