ぶろぐめんどくさい

技術系の記事と漫画レビューが入り混じった混沌

2016-12-01から1日間の記事一覧

c++のスレッドで返り値が欲しいのならば

返り値に代わる変数を渡せばいいじゃない。 #include <thread> #include <stdio.h> int th(int* ret) { printf("1"); ret = 1; return 1; } int main() { int ret; std::thread th(th, &ret); th.join(); return 0; } ね、簡単でしょ。</stdio.h></thread>