summaryrefslogtreecommitdiff
path: root/src/utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-05-06 13:51:23 +0200
committerMaxime Coste <frrrwww@gmail.com>2013-05-06 13:51:23 +0200
commit2342e7686fb9de142b0f331852bb5294c55c6440 (patch)
treea9d2f0f2b0374c54500d85631078fa11f7b97373 /src/utils.hh
parent42d7fcacd8df3f3d6a88ecd7f21750531828502d (diff)
add specialized contains function for unordered_set
Diffstat (limited to 'src/utils.hh')
-rw-r--r--src/utils.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.hh b/src/utils.hh
index e7315cc2..73950562 100644
--- a/src/utils.hh
+++ b/src/utils.hh
@@ -7,6 +7,7 @@
#include <algorithm>
#include <memory>
#include <vector>
+#include <unordered_set>
namespace Kakoune
{
@@ -182,6 +183,12 @@ bool contains(Container&& container, const T& value)
return (not container.empty()) and find(container, value) != container.end();
}
+template<typename T1, typename T2>
+bool contains(const std::unordered_set<T1>& container, const T2& value)
+{
+ return container.find(value) != container.end();
+}
+
// *** On scope end ***
//
// on_scope_end provides a way to register some code to be