#include <iostream>
#include <thread>
using namespace std;
thread&& launch(){
thread launchee([](){
this_thread::sleep_for(chrono::milliseconds(280));
cout<<"HA!"<<endl;
});
return move(launchee);
}
int main(int argc, char **argv){
thread mine(launch());
mine.join();
}
でコンパイルg++-4.6 -std=c++0x 1.cpp -o e1 -pthread
「アクティブな例外なしで呼び出された終了」を出力し、プログラムを中止します。
これはうまくいくはずですよね??