4#include "../Foundation/Assert.h"
23template <
typename ForwardIterator,
typename UnaryPredicate>
24constexpr ForwardIterator
findIf(ForwardIterator first, ForwardIterator last, UnaryPredicate&& predicate,
25 size_t* index =
nullptr)
28 for (
auto it = first; it != last; ++it)
34 *index =
static_cast<size_t>(it - first);
49template <
typename Container,
typename T>
50constexpr bool contains(Container container,
const T& value,
size_t* index =
nullptr)
53 container.begin(), container.end(), [&](
auto& item) { return item == value; }, index) != container.end();
constexpr bool contains(Container container, const T &value, size_t *index=nullptr)
Check if the container contains a given value.
Definition AlgorithmFind.h:50
constexpr ForwardIterator findIf(ForwardIterator first, ForwardIterator last, UnaryPredicate &&predicate, size_t *index=nullptr)
Find item satisfying the given predicate.
Definition AlgorithmFind.h:24
#define SC_ASSERT_DEBUG(e)
Assert expression e to be true.
Definition Assert.h:82