4 ms·
i wonder why they didn't have the execution policy of a template parameter - if they pass the object on the stack then they would have to switch on the type in
by MichaelMoser123 8y ago
i wonder why they didn't have the execution policy of a template parameter - if they pass the object on the stack then they would have to switch on the type in runtime, with template parameter you can have a specialization on the type without that overhead.
Also what is exactly the difference between parallel_execution_policy and parallel_vector_execution_policy ?
- fourthark 8y agoIt is a template parameter, they just use a global object of a particular type to select it, probably for easier defaulting. E.g. https://en.cppreference.com/w/cpp/experimental/reduce https://en.cppreference.com/w/cpp/experimental/reduce
- MichaelMoser123 8y agothanks, didn't notice the declaration - this way they can deduce the type without having to specify the template parameter directly in the call - and you don't have to pass an actual instance; clever. You never stop learning with c++ template<class T> void foo(T &&);