Skip to content

Commit 63099f2

Browse files
author
Ruyman
committed
Update d0796r1.md
Fixed Listing 1 with correct syntax
1 parent 24299a4 commit 63099f2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

affinity/cpp-20/d0796r1.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ Consider a code example (Listing 1) that uses the C++17 parallel STL algorithm `
4545
std::valarray<double> a(N);
4646

4747
// Data placement is wrong, so parallel update is slow.
48-
std::for_each(par, std::begin(a), std::end(a),
49-
[=] (double& a_i) { scalar * a_i; });
50-
48+
std::for_each(par, std::begin(a), std::end(a),
49+
[=] (double& a_i) { a_i *= scalar; });
50+
5151
// Use future affinity interface to migrate data at next
5252
// use and move pages closer to next accessing thread.
5353
...
5454
// Faster, because data are local now.
55-
std::for_each(par, std::begin(a), std::end(a),
56-
[=] (double& a) { scalar * a_i; } );
55+
std::for_each(par, std::begin(a), std::end(a),
56+
[=] (double& a_i) { a_i *= scalar; });
5757
```
5858
*Listing 1: Parallel vector update example*
5959

0 commit comments

Comments
 (0)