add specialized contains function for unordered_set

This commit is contained in:
Maxime Coste 2013-05-06 13:51:23 +02:00
parent 42d7fcacd8
commit 2342e7686f

View File

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <unordered_set>
namespace Kakoune namespace Kakoune
{ {
@ -182,6 +183,12 @@ bool contains(Container&& container, const T& value)
return (not container.empty()) and find(container, value) != container.end(); 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 ***
// //
// on_scope_end provides a way to register some code to be // on_scope_end provides a way to register some code to be