Buffer() : buff_{} {}
- template <class Ex, class DEx = _t<std::decay<Ex>>>
- Buffer(in_place_t, Ex&& ex);
+ template <class Ex, typename... As>
+ Buffer(in_place_type_t<Ex>, As&&... as_);
template <class Ex>
Ex& as() noexcept;
template <class Ex>
"Surprise! std::exception and std::type_info don't have alignment "
"greater than one. as_int_ below will not work!");
- static std::uintptr_t as_int_(std::exception const& e);
- static std::uintptr_t as_int_(AnyException e);
+ static std::uintptr_t as_int_(
+ std::exception_ptr const& ptr,
+ std::exception const& e);
+ static std::uintptr_t as_int_(
+ std::exception_ptr const& ptr,
+ AnyException e);
bool has_exception_() const;
std::exception const* as_exception_() const;
std::type_info const* as_type_() const;
struct Impl final : public Base {
Ex ex_;
Impl() = default;
- explicit Impl(Ex const& ex) : Base{typeid(ex)}, ex_(ex) {}
- explicit Impl(Ex&& ex)
- : Base{typeid(ex)},
- ex_(std::move(ex)){}[[noreturn]] void throw_() const override;
+ template <typename... As>
+ explicit Impl(As&&... as)
+ : Base{typeid(Ex)}, ex_(std::forward<As>(as)...) {}
+ [[noreturn]] void throw_() const override;
std::exception const* get_exception_() const noexcept override;
exception_wrapper get_exception_ptr_() const noexcept override;
};
};
VTable const* vptr_{&uninit_};
- template <class Ex, class DEx = _t<std::decay<Ex>>>
- exception_wrapper(Ex&& ex, OnHeapTag);
+ template <class Ex, typename... As>
+ exception_wrapper(OnHeapTag, in_place_type_t<Ex>, As&&... as);
- template <class Ex, class DEx = _t<std::decay<Ex>>>
- exception_wrapper(Ex&& ex, InSituTag);
+ template <class Ex, typename... As>
+ exception_wrapper(InSituTag, in_place_type_t<Ex>, As&&... as);
template <class T>
struct IsRegularExceptionType
FOLLY_REQUIRES(IsRegularExceptionType<Ex_>::value)>
exception_wrapper(in_place_t, Ex&& ex);
+ template <
+ class Ex,
+ typename... As,
+ FOLLY_REQUIRES(IsRegularExceptionType<Ex>::value)>
+ exception_wrapper(in_place_type_t<Ex>, As&&... as);
+
//! Swaps the value of `*this` with the value of `that`
void swap(exception_wrapper& that) noexcept;
*/
template <class Ex, typename... As>
exception_wrapper make_exception_wrapper(As&&... as) {
- return exception_wrapper{Ex{std::forward<As>(as)...}};
+ return exception_wrapper{in_place<Ex>, std::forward<As>(as)...};
}
/**