C++: Difference between revisions
Line 608: | Line 608: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Functional Programming== | |||
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>. | |||
;Map | |||
* <code>std::for_each</code> | |||
* <code>std::transform</code> | |||
;Reduce/Fold | |||
* <code>std::accumulate</code> | |||
;Filter | |||
* <code>std::copy_if</code> | |||
* <code>std::remove_if</code> | |||
* <code>std::find_if</code> | |||
==Programming Styles== | ==Programming Styles== |