+exception_wrapper exception_wrapper::from_exception_ptr(
+ std::exception_ptr const& ptr) noexcept {
+ if (!ptr) {
+ return exception_wrapper();
+ }
+ try {
+ std::rethrow_exception(ptr);
+ } catch (std::exception& e) {
+ return exception_wrapper(std::current_exception(), e);
+ } catch (...) {
+ return exception_wrapper(std::current_exception());
+ }
+}
+