diff --git a/SimoxUtility/algorithm/vector.hpp b/SimoxUtility/algorithm/vector.hpp index 8679bdcf6d3bc996cbf4095c57f1ca4dd3734f31..9064495180dcc8f97bbe88894eaa758227cf60d1 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)