You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template<std::ranges::range Range>
voidbatch_enqueue_detach(Range&& tasks);
// a bit simplifiedtemplate<std::ranges::range Range, RangeValue, RangeValueReturnType>
std::vector<std::future<RangeValueReturnType>> batch_equeue(Range&& tasks);
The non-detached version will prove to be challenging but should be possible. With non-C++23 code, it will be a bit memory greedy with std::shared_ptr allocations but that is a necessary tradeoff unfortunately.
The other question that remains is should we create a way to be able to pass a range of input parameters to the range of tasks? If so, how would this look?
Since std::apply exists, we could just require that a range of values that is to be used as arguments is the same length as the input batch of tasks and that the value type of the range is tuple-like. In fact, the standard specifies
The tuple need not be std::tuple, and instead may be anything that supports std::get and std::tuple_size; in particular, std::array and std::pair may be used.
Description
Would be good to add versions of
enqueue()
andenqueue_detach()
that would allow for submission of multiple tasks at once so that they can be batched.The text was updated successfully, but these errors were encountered: