Parallel STL String Length Reduction
Parallel STL std::transform_reduce • Haskells function map is called std::transform in C++ • std::transform_reduce ➡ std::map_reduce std::vector<std::string> arrVec{"Only", "for", "testing", "purpose"}; std::size_t res = std::transform_reduce(std::execution::par, arrVec.begin(), arrVec.end(), 0, [](std::size_t a, std::size_t b) { return a + b; }, [](std::string s) { return s.length(); }); std::cout << res; // 21
A photographed presentation slide titled “Parallel STL” shows a C++ std::transform_reduce example that calculates the combined length of the words “Only for testing purpose.” The joke is the playful comparison to Haskell’s map function and the overly elaborate parallel C++ solution for a simple task, producing 21. EN: A photographed presentation slide titled “Parallel STL” shows a C++ std::transform_reduce example that calculates the combined length of the words “Only for testing purpose.” The joke is the playful comparison to Haskell’s map function and the overly elaborate parallel C++ solution for a simple task, producing 21.
- @ithueti / 856 2019-04-20
- Type
- image
- Size
- 800×600 · 33.3 KiB
- Mood
- ironic, educational
- Language
- en
- Added