function object
std::ranges::for_each_n
- Header
<algorithm>- Draft
- [alg.foreach]
- Scope
std::ranges- cppreference
- std::ranges::for_each_n
Synopsis
inline constexpr /* implementation-defined */ for_each_n = {};Call signatures
for_each_n is a function object; these are its call operators as libycxx declares them, written as the functions the draft declares.
- (1)
template< std::input_iterator I, class Proj = std::identity, std::indirectly_unary_invocable<std::projected<I, Proj>> Fun> constexpr std::ranges::for_each_n_result<I, Fun> for_each_n( I first, std::iter_difference_t<I> n, Fun f, Proj proj = {}); - (2)
template< class ExecutionPolicy, std::random_access_iterator I, class Proj = std::identity, std::indirectly_unary_invocable<std::projected<I, Proj>> Fun> requires execution-policy<ExecutionPolicy> I for_each_n( ExecutionPolicy&&, I first, std::iter_difference_t<I> n, Fun f, Proj proj = {}) noexcept;