From 8e52fff51e7cce9d559656b2c5ffac5775c335f6 Mon Sep 17 00:00:00 2001
From: "fabian.peller-konrad@kit.edu" <fabian.peller-konrad@kit.edu>
Date: Sat, 24 Jul 2021 13:13:42 +0200
Subject: [PATCH] added a contains method

---
 SimoxUtility/algorithm/vector.hpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/SimoxUtility/algorithm/vector.hpp b/SimoxUtility/algorithm/vector.hpp
index 8679bdcf6..906449518 100644
--- a/SimoxUtility/algorithm/vector.hpp
+++ b/SimoxUtility/algorithm/vector.hpp
@@ -1,11 +1,18 @@
 #pragma once
 
 #include <vector>
-
+#include <algorithm>
 
 namespace simox::alg
 {
 
+    template <typename TypeT>
+    bool
+    contains(const std::vector<TypeT>& haystack, const TypeT& needle)
+    {
+        return std::find(haystack.begin(), haystack.end(), needle) != haystack.end();
+    }
+
     template <typename TypeT>
     std::vector<TypeT>
     appended(const std::vector<TypeT>& v1, const std::vector<TypeT>& v2)
-- 
GitLab