X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2FExceptionWrapper.h;h=0d028714231fa5ad6fde57055c41b6734b13356f;hp=d8b6a4d8b02b36d09dffc3de21f6122371fc312b;hb=48d3f5e1691033d00ecc2ef0c3ced83ce148705a;hpb=8f8a5e472c5de694bde9cbfe508a782027591fcf diff --git a/folly/ExceptionWrapper.h b/folly/ExceptionWrapper.h index d8b6a4d8..0d028714 100644 --- a/folly/ExceptionWrapper.h +++ b/folly/ExceptionWrapper.h @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include #ifdef __GNUC__ #pragma GCC diagnostic push @@ -197,7 +197,7 @@ class exception_wrapper final { exception_wrapper (*get_exception_ptr_)(exception_wrapper const*); }; - [[noreturn]] static void onNoExceptionError(); + [[noreturn]] static void onNoExceptionError(char const* name); template static Ret noop_(Args...); @@ -368,6 +368,9 @@ class exception_wrapper final { static bool with_exception_(This& this_, Fn fn_); public: + static exception_wrapper from_exception_ptr( + std::exception_ptr const& eptr) noexcept; + //! Default-constructs an empty `exception_wrapper` //! \post `type() == none()` exception_wrapper() noexcept {} @@ -444,7 +447,7 @@ class exception_wrapper final { //! Swaps the value of `*this` with the value of `that` void swap(exception_wrapper& that) noexcept; - //! \return `true` if `*this` is not holding an exception. + //! \return `true` if `*this` is holding an exception. explicit operator bool() const noexcept; //! \return `!bool(*this)` @@ -643,7 +646,7 @@ inline exception_wrapper try_and_catch_(F&& f) { return exception_wrapper(std::current_exception(), ex); } } -} // detail +} // namespace detail //! `try_and_catch` is a simple replacement for `try {} catch(){}`` that allows //! you to specify which derived exceptions you would like to catch and store in @@ -684,7 +687,7 @@ template exception_wrapper try_and_catch(F&& fn) { return detail::try_and_catch_(std::forward(fn)); } -} // folly +} // namespace folly #include