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
6
namespace
etl
{
7
18
template
<
typename
InIt,
typename
OutIt,
typename
Pred>
19
constexpr
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
etl::copy_if
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
etl
Definition
adjacent_find.hpp:8
include
etl
_algorithm
copy_if.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0