Created
November 1, 2013 07:36
-
-
Save wilhelmjung/7262023 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // compile with: /EHsc | |
| #include <windows.h> | |
| #include <ppl.h> | |
| #include <concurrent_vector.h> | |
| #include <array> | |
| #include <vector> | |
| #include <tuple> | |
| #include <algorithm> | |
| #include <iostream> | |
| #include <cstdlib> // rand() | |
| //using namespace concurrency; // ns for ppl | |
| using namespace std; | |
| struct my_ftor { | |
| void operator() (double d) | |
| { | |
| cout << d << " "; | |
| } | |
| } printer; | |
| int main() | |
| { | |
| array<double, 10> seq; | |
| generate(begin(seq), end(seq), [] | |
| { | |
| return (double)rand() / (double)RAND_MAX; | |
| }); | |
| for_each(begin(seq), end(seq), [] (double &item) | |
| { | |
| item = sin(item); | |
| }); | |
| cout << "seq: "; | |
| for_each(begin(seq), end(seq), printer); | |
| cout << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment