tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
find_first_of.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_FIND_FIRST_OF_HPP
4#define TETL_ALGORITHM_FIND_FIRST_OF_HPP
5
7
8namespace etl {
9
24template <typename InputIt, typename ForwardIt, typename Predicate>
25[[nodiscard]] constexpr auto
26find_first_of(InputIt first, InputIt last, ForwardIt sFirst, ForwardIt sLast, Predicate pred) -> InputIt
27{
28 for (; first != last; ++first) {
29 for (auto it = sFirst; it != sLast; ++it) {
30 if (pred(*first, *it)) {
31 return first;
32 }
33 }
34 }
35
36 return last;
37}
38
50template <typename InputIt, typename ForwardIt>
51[[nodiscard]] constexpr auto find_first_of(InputIt first, InputIt last, ForwardIt sFirst, ForwardIt sLast) -> InputIt
52{
53 return etl::find_first_of(first, last, sFirst, sLast, etl::equal_to());
54}
55
56} // namespace etl
57
58#endif // TETL_ALGORITHM_FIND_FIRST_OF_HPP
constexpr auto find_first_of(InputIt first, InputIt last, ForwardIt sFirst, ForwardIt sLast, Predicate pred) -> InputIt
Searches the range [first, last) for any of the elements in the range [sFirst, sLast)....
Definition find_first_of.hpp:26
Definition adjacent_find.hpp:8
Function object for performing comparisons. Unless specialised, invokes operator== on type T....
Definition equal_to.hpp:14