futures::halve_partitioner
Algorithms / Partitioners / halve_partitioner
Defined in header <futures/algorithm/partitioner/halve_partitioner.hpp>
class halve_partitioner;
A partitioner that always splits the problem in half.
Description
The halve partitioner always splits the sequence into two parts of roughly equal size
The sequence is split up to a minimum grain size. As a concept, the result from the partitioner is considered a suggestion for parallelization. For algorithms such as for_each, a partitioner with a very small grain size might be appropriate if the operation is very expensive. Some algorithms, such as a binary search, might naturally adjust this suggestion so that the result makes sense.
Public Functions
Member Functions | Description |
---|---|
(constructor) | Constructor. (function) |
operator() | Split a range of elements. (function template) |
Public Functions
function halve_partitioner
Defined in header <futures/algorithm/partitioner/halve_partitioner.hpp>
explicit constexpr
halve_partitioner(std::size_t min_grain_size_);
Constructor.
Parameters
- min_grain_size_ - Minimum grain size used to split ranges
Description
The constructor has a minimum grain size after which the range should not be split.
Exception Safety
Basic exception guarantee.
function operator()
Defined in header <futures/algorithm/partitioner/halve_partitioner.hpp>
template <std::input_iterator I, std::sentinel_for< I > S>
I
operator()(I first, S last);
Split a range of elements.
Template Parameters
- I - Iterator type
- S - Sentinel type
Parameters
- first - First element in range
- last - Last element in range
Return value
Iterator to point where sequence should be split
Exception Safety
Basic exception guarantee.
Updated on 2023-01-04