This commit is contained in:
jeanlemotan
2024-07-02 18:06:33 +02:00
commit 8297b0b45f
157 changed files with 24865 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#include "tl/detail/prologue.h"
#include "tl/algorithm/find.h"
#include <iterator>
namespace tl
{
//////////////////////////////////////////////////////////////////////////
template <typename C, typename T>
bool contains(C& c, T&& value) noexcept
{
return tl::find(c, std::forward<T>(value)) != tl::end(c);
}
template <typename C, typename T>
bool contains(const C& c, T&& value) noexcept
{
return tl::cfind(c, std::forward<T>(value)) != tl::end(c);
}
template <typename C, typename UnaryPredicate>
bool contains_if(C& c, UnaryPredicate&& p) noexcept
{
return tl::find_if(c, std::forward<UnaryPredicate>(p)) != tl::end(c);
}
template <typename C, typename UnaryPredicate>
bool contains_if(const C& c, UnaryPredicate&& p) noexcept
{
return tl::cfind_if(c, std::forward<UnaryPredicate>(p)) != tl::end(c);
}
//////////////////////////////////////////////////////////////////////////
}