Created
April 16, 2012 01:54
-
-
Save spullara/2395968 to your computer and use it in GitHub Desktop.
Modern c++11
This file contains 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
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <vector> | |
#include <future> | |
using namespace std; | |
string flip(string s) { | |
reverse( begin(s), end(s) ); | |
return s; | |
} | |
int main() { | |
vector<future<string>> v; | |
v.push_back( async([]{ return flip(" ,olleH"); })); | |
v.push_back( async([]{ return flip(".gnaL"); })); | |
v.push_back( async([]{ return flip("\n!TXEN"); })); | |
for (auto& e: v) { | |
cout << e.get(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After installing gcc 4.7 with macports, I was able to compile this on my Mac with:
g++-mp-4.7 -std=c++11 -o main main.cpp