summaryrefslogtreecommitdiff
path: root/zen/stl_tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/stl_tools.h')
-rw-r--r--zen/stl_tools.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/zen/stl_tools.h b/zen/stl_tools.h
index c2e8eff3..0d359641 100644
--- a/zen/stl_tools.h
+++ b/zen/stl_tools.h
@@ -290,13 +290,26 @@ Num hashArray(ByteIterator first, ByteIterator last)
struct StringHash //support for custom string classes with std::unordered_set/map
{
+ using is_transparent = int; //allow heterogenous lookup!
+
template <class String>
size_t operator()(const String& str) const
{
- const auto* strFirst = strBegin(str);
+ const auto* const strFirst = strBegin(str);
return hashArray<size_t>(strFirst, strFirst + strLength(str));
}
};
+
+struct StringEqual
+{
+ using is_transparent = int; //allow heterogenous lookup!
+
+ template <class String1, class String2>
+ bool operator()(const String1& lhs, const String2& rhs) const
+ {
+ return equalString(lhs, rhs);
+ }
+};
}
#endif //STL_TOOLS_H_84567184321434
bgstack15