Shows how to use std::exception_ptr and invalid_operation_exception exception.
#include <xtd/threading/thread>
#include <xtd/console>
#include <xtd/invalid_operation_exception>
auto main()->int {
auto exception_pointer = std::exception_ptr {};
try {
} catch (...) {
exception_pointer = std::current_exception();
}
}};
thread1.start();
thread1.join();
if (exception_pointer) {
try {
rethrow_exception(exception_pointer);
}
}
}