tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
all_of.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_ALGORITHM_ALL_OF_HPP
5#define TETL_ALGORITHM_ALL_OF_HPP
6
7#include <etl/_algorithm/find_if_not.hpp>
8
9namespace etl {
10
11/// \ingroup algorithm
12/// @{
13
14/// \brief Checks if unary predicate p returns true for all elements in the range `[first, last)`.
15template <typename InputIt, typename Predicate>
16[[nodiscard]] constexpr auto all_of(InputIt first, InputIt last, Predicate p) -> bool
17{
18 return etl::find_if_not(first, last, p) == last;
19}
20
21/// @}
22
23} // namespace etl
24
25#endif // TETL_ALGORITHM_ALL_OF_HPP
constexpr auto all_of(InputIt first, InputIt last, Predicate p) -> bool
Checks if unary predicate p returns true for all elements in the range [first, last).
Definition all_of.hpp:16
Definition adjacent_find.hpp:9