Jump to content

C++: Difference between revisions

Line 616: Line 616:
https://medium.com/swlh/doing-it-the-functional-way-in-c-5c392bbdd46a
https://medium.com/swlh/doing-it-the-functional-way-in-c-5c392bbdd46a


Many of these can be parallelized with [https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t execution policies] such as <code>std::execution::par</code> and <code>std::execution::par_unseq</code>.
Many of these can be parallelized with [https://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t execution policies] such as <code>std::execution::par</code> and <code>std::execution::par_unseq</code>. Paired with [https://adaptivecpp.github.io/AdaptiveCpp/stdpar/ AdaptiveCPP], some operations can be automatically GPU accelerated as well.


Most of these require C++20.
Most of these require C++20.
Line 623: Line 623:
* <code>std::for_each</code>
* <code>std::for_each</code>
* <code>std::transform</code>
* <code>std::transform</code>
* [https://en.cppreference.com/w/cpp/algorithm/copy <code>std::copy</code>, <code>std::copy_if</code>]
* [https://en.cppreference.com/w/cpp/algorithm/fill <code>std::fill</code>]


;Reduce/Fold
;Reduce/Fold