exception_ptr in エラーハンドリング勉強会
- 2. イントロ
int main() {
int result;
std::thread t(f, ref(result));
// ……
t.join();
cout << result << endl;
}
- 8. 案3 exception_ptr
int result; exception_ptr e;
thread t(f, ref(result), ref(e));
t.join();
try {rethrow_exception(e);}
catch (std::exception const& e) {...}
- 9. 案3 exception_ptr
int result; exception_ptr e;
thread t(f, ref(result), ref(e));
t.join();
try {rethrow_exception(e);}
catch (std::exception const& e) {...}
catch (MyException const& e) {...}