26 std::convertible_to<std::invoke_result_t<Func, Num>,
T>
class GeneratorRdd
27 :
public BaseRdd<GeneratorRdd<Num, Func, T>> {
37 using difference_type = std::ptrdiff_t;
74 constexpr GeneratorRdd(Num
begin, Num
end, Func func, ExecutionContext* context)
75 : Base{context}, func_{std::move(func)}, begin_{
begin}, end_{
end} {
76 static_assert(concepts::Rdd<GeneratorRdd<Num, Func, T>>,
77 "Instance of GeneratorRdd does not satisfy Rdd concept.");
81 for (
size_t i : std::views::iota(size_t{0}, Base::splits_num_)) {
82 size_t total_size =
static_cast<size_t>(end_ - begin_);
83 size_t split_size = (total_size + Base::splits_num_ - 1) / Base::splits_num_;
84 auto b = Iterator{&func, begin_ +
static_cast<Num
>(std::min(total_size, i * split_size))};
86 Iterator{&func, begin_ +
static_cast<Num
>(std::min(total_size, (i + 1) * split_size))};
87 splits_.emplace_back(std::ranges::subrange{b, e}, Base::context_);
95 constexpr GeneratorRdd(
const GeneratorRdd&) =
default;
96 GeneratorRdd& operator=(
const GeneratorRdd&) =
default;
99 constexpr auto beginImpl()
const {
return std::ranges::begin(splits_); }
101 constexpr auto endImpl()
const {
return std::ranges::end(splits_); }
107 std::vector<ViewSplit<std::ranges::subrange<Iterator>>> splits_{};