tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
replace_if.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_ALGORITHM_REPLACE_IF_HPP
4
#define TETL_ALGORITHM_REPLACE_IF_HPP
5
6
namespace
etl
{
7
12
template
<
typename
ForwardIt,
typename
Predicate,
typename
T>
13
constexpr
auto
replace_if
(ForwardIt first, ForwardIt last, Predicate p, T
const
& newValue) ->
void
14
{
15
for
(; first != last; ++first) {
16
if
(p(*first)) {
17
*first = newValue;
18
}
19
}
20
}
21
22
}
// namespace etl
23
24
#endif
// TETL_ALGORITHM_REPLACE_IF_HPP
etl::replace_if
constexpr auto replace_if(ForwardIt first, ForwardIt last, Predicate p, T const &newValue) -> void
Replaces all elements satisfying specific criteria with new_value in the range [first,...
Definition
replace_if.hpp:13
etl
Definition
adjacent_find.hpp:8
include
etl
_algorithm
replace_if.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0