tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
for_each_n.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ALGORITHM_FOR_EACH_N_HPP
4#define TETL_ALGORITHM_FOR_EACH_N_HPP
5
6namespace etl {
7
19template <typename InputIt, typename Size, typename UnaryFunc>
20constexpr auto for_each_n(InputIt first, Size n, UnaryFunc f) noexcept -> InputIt
21{
22 for (Size i = 0; i < n; ++first, (void)++i) {
23 f(*first);
24 }
25 return first;
26}
27
28} // namespace etl
29
30#endif // TETL_ALGORITHM_FOR_EACH_N_HPP
constexpr auto for_each_n(InputIt first, Size n, UnaryFunc f) noexcept -> InputIt
Applies the given function object f to the result of dereferencing every iterator in the range [first...
Definition for_each_n.hpp:20
Definition adjacent_find.hpp:8