hpx::ranges::generate#
Defined in header hpx/algorithm.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
See also:
-
template<typename ExPolicy, typename Rng, typename F>
hpx::parallel::util::detail::algorithm_result<ExPolicy, std::ranges::iterator_t<Rng>> hpx::ranges::generate(ExPolicy &&policy, Rng &&rng, F &&f)# Assign each element in range [first, last) a value generated by the given function object f
The assignments in the parallel generate algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel generate algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
Note
Complexity: Exactly distance(first, last) invocations of f and assignments.
- Template Parameters:
ExPolicy – The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
F – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of equal requires F to meet the requirements of CopyConstructible.
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
rng – Refers to the sequence of elements the algorithm will be applied to.
f – generator function that will be called. signature of function should be equivalent to the following:
The type Ret must be such that an object of type FwdIter can be dereferenced and assigned a value of type Ret.Ret fun();
- Returns:
The replace_if algorithm returns a hpx::future<FwdIter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns FwdIter otherwise. It returns last.
-
template<typename ExPolicy, typename Iter, typename Sent, typename F>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, Iter> hpx::ranges::generate(ExPolicy &&policy, Iter first, Sent last, F &&f)# Assign each element in range [first, last) a value generated by the given function object f
The assignments in the parallel generate algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel generate algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.
Note
Complexity: Exactly distance(first, last) invocations of f and assignments.
- Template Parameters:
ExPolicy – The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.
Iter – The type of the source begin iterator used (deduced). This iterator type must meet the requirements of an forward iterator.
Sent – The type of the source end iterator used (deduced). This iterator type must meet the requirements of an forward iterator.
F – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of equal requires F to meet the requirements of CopyConstructible.
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
f – generator function that will be called. signature of function should be equivalent to the following:
The type Ret must be such that an object of type FwdIter can be dereferenced and assigned a value of type Ret.Ret fun();
- Returns:
The replace_if algorithm returns a hpx::future<FwdIter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns FwdIter otherwise. It returns last.
-
template<typename Rng, typename F>
std::ranges::iterator_t<Rng> hpx::ranges::generate(Rng &&rng, F &&f)# Assign each element in range [first, last) a value generated by the given function object f
Note
Complexity: Exactly distance(first, last) invocations of f and assignments.
- Template Parameters:
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
F – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of equal requires F to meet the requirements of CopyConstructible.
- Parameters:
rng – Refers to the sequence of elements the algorithm will be applied to.
f – generator function that will be called. signature of function should be equivalent to the following:
The type Ret must be such that an object of type FwdIter can be dereferenced and assigned a value of type Ret.Ret fun();
- Returns:
The replace_if algorithm returns last.
-
template<typename Iter, typename Sent, typename F>
Iter hpx::ranges::generate(Iter first, Sent last, F &&f)# Assign each element in range [first, last) a value generated by the given function object f
Note
Complexity: Exactly distance(first, last) invocations of f and assignments.
- Template Parameters:
Iter – The type of the source begin iterator used (deduced). This iterator type must meet the requirements of an forward iterator.
Sent – The type of the source end iterator used (deduced). This iterator type must meet the requirements of an forward iterator.
F – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of equal requires F to meet the requirements of CopyConstructible.
- Parameters:
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to the end of the sequence of elements the algorithm will be applied to.
f – generator function that will be called. signature of function should be equivalent to the following:
The type Ret must be such that an object of type FwdIter can be dereferenced and assigned a value of type Ret.Ret fun();
- Returns:
The replace_if algorithm returns last.