Is the behavior of the following snippet well-defined?
std::exception_ptr eptr;
try {
...
} catch (...) {
eptr = std::current_exception();
}
std::exception_ptr eptr2(eptr);
std::vector<std::exception_ptr> eptrs{eptr, eptr2};
for (auto& exc: eptrs) try {
std::rethrow_exception(exc);
} catch(std::exception& e) {
std::cout << e.what() << '\n';
}
If so, does this require that the exception object itself (not just exception_ptr) be copyable?
Aucun commentaire:
Enregistrer un commentaire