2013-11-01から1ヶ月間の記事一覧

std::asyncめも

std::asyncなるものがあると聞いたので、とりあえずどんな感じで使えばいいのかをめも。 まずはこちらから。 #include <iostream> #include <thread> #include <future> #include <chrono> using namespace std; class Hoge{ public: Hoge(){ cout << "Hoge::Hoge()" << endl; } ~Hoge(){ cout <</chrono></future></thread></iostream>…

std::threadつかってみる

std::threadの使い方メモ。 まずは基本から。 #include <iostream> #include <thread> using namespace std; class Hoge{ public: Hoge() : m_count(0){/**/} void operator()(){ for(int i=0; i<10000000; ++i){ m_count++; } } int m_count; }; int main(int argc, char **ar</thread></iostream>…