Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do std::ranges algorithms lack parallel overloads (taking an execution policy parameter)?

Many functions in the C++ Algorithms library have overloads taking a parameter of type ExecutionPolicy, e.g. std::copy. However, I noticed that the corresponding functions in the std::ranges namespace do not have these parallel overloads. This is unfortunate because it means that for many cases the non-ranged variants will be more useful.

What is the reason for this? And are there proposals to add parallel overloads to the std::ranges namespace?

like image 442
SWdV Avatar asked Aug 25 '20 09:08

SWdV


1 Answers

Concluding from Eric Niebler's (and other authors') numerous answers (during talks and on his github comments), they (the committee and the authors) simply ran out of time. The proposal was already large (notice the fact that it heavily referenced the <concepts> proposals) and adding even more to it would spawn a risk of not shipping anything from <ranges> to c++20.

Parallel overloads are not the only things that missed the boat. Various views are absent (both due to lack of time and some semantical problems (looking at you, zip)), there are zero actions and nothing from <numeric> was rangified.

<ranges> will surely evolve further, but polishing the proposals requires time. We can't predict the future, but I would be seriously surprised if <ranges> didn't grow bigger with c++23.

like image 196
Fureeish Avatar answered Oct 31 '22 11:10

Fureeish