From 1c6eef08f126b726c367a5c9fd9c5a49680e8321 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 17 Oct 2011 21:05:22 +0000 Subject: [PATCH] utils: add contains function --- src/utils.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils.hh b/src/utils.hh index fcc7a77a..6bfdb907 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -5,6 +5,7 @@ #include "assert.hh" #include +#include namespace Kakoune { @@ -99,6 +100,13 @@ private: template T* Singleton::ms_instance = nullptr; +template +bool contains(const Container& container, const T& value) +{ + return std::find(container.begin(), container.end(), value) + != container.end(); +} + } #endif // utils_hh_INCLUDED