X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2FExceptionWrapper-inl.h;h=aca35f2cb255c7ae8cc3958173b3cf54f153e9f1;hp=99cbd9de39a9b6bf72181a38b01ab3fd098c598a;hb=f0daf647cd1435d8511b0fd8c64b31ed37e8beb8;hpb=5947e77818dae0a0409bbe0d577464f7b2a7a687 diff --git a/folly/ExceptionWrapper-inl.h b/folly/ExceptionWrapper-inl.h index 99cbd9de..aca35f2c 100644 --- a/folly/ExceptionWrapper-inl.h +++ b/folly/ExceptionWrapper-inl.h @@ -350,6 +350,20 @@ inline std::exception const* exception_wrapper::get_exception() const noexcept { return vptr_->get_exception_(this); } +template +inline Ex* exception_wrapper::get_object() noexcept { + Ex* object{nullptr}; + with_exception([&](Ex& ex) { object = &ex; }); + return object; +} + +template +inline Ex const* exception_wrapper::get_object() const noexcept { + Ex const* object{nullptr}; + with_exception([&](Ex const& ex) { object = &ex; }); + return object; +} + inline std::exception_ptr const& exception_wrapper::to_exception_ptr() noexcept { // Computing an exception_ptr is expensive so cache the result.