tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
copy_if.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_COPY_IF_HPP
4#define TETL_ALGORITHM_COPY_IF_HPP
5
6namespace etl {
7
18template <typename InIt, typename OutIt, typename Pred>
19constexpr auto copy_if(InIt first, InIt last, OutIt dFirst, Pred pred) -> OutIt
20{
21 while (first != last) {
22 if (pred(*first)) {
23 *dFirst++ = *first;
24 }
25 ++first;
26 }
27 return dFirst;
28}
29
30} // namespace etl
31
32#endif // TETL_ALGORITHM_COPY_IF_HPP
constexpr auto copy_if(InIt first, InIt last, OutIt dFirst, Pred pred) -> OutIt
Copies the elements in the range, defined by [first, last), to another range beginning at destination...
Definition copy_if.hpp:19
Definition adjacent_find.hpp:8