How to get the argument for promise::set_exception(x)? How to get the argument for promise::set_exception(x)? multithreading multithreading

How to get the argument for promise::set_exception(x)?


There is a different name for copy_exception. copy_exception was renamed late in the standardization process over confusion of what it actually did:

template<class E>   exception_ptr make_exception_ptr(E e) noexcept;

Effects: Creates an exception_ptr object that refers to a copy of e, ...

Use of either make_exception_ptr or current_exception is fine, depending on what exception you're trying to set.