tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
find_if.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_FIND_IF_HPP
4#define TETL_ALGORITHM_FIND_IF_HPP
5
6namespace etl {
7
17template <typename InputIt, typename Predicate>
18[[nodiscard]] constexpr auto find_if(InputIt first, InputIt last, Predicate pred) noexcept -> InputIt
19{
20 for (; first != last; ++first) {
21 if (pred(*first)) {
22 return first;
23 }
24 }
25 return last;
26}
27
28} // namespace etl
29
30#endif // TETL_ALGORITHM_FIND_IF_HPP
constexpr auto find_if(InputIt first, InputIt last, Predicate pred) noexcept -> InputIt
Searches for an element for which predicate p returns true.
Definition find_if.hpp:18
Definition adjacent_find.hpp:8