make_exception_ptr

创建保留异常副本的 exception_ptr 对象。

template <class E> 
    exception_ptr make_exception_ptr(E Except);

参数

  • Except
    具有要复制的异常的类。 通常,你指定异常类对象作为参数传递给 make_exception_ptr 函数,但任意类对象都可以是参数。

返回值

指向 Except 的当前异常副本的 exception_ptr 对象。

备注

调用 make_exception_ptr 函数等效于引发 C++ 异常、在 catch 块中捕获它并调用 current_exception 函数以返回引用异常的 exception_ptr 对象。 Microsoft 实现的 make_exception_ptr 函数比调用并捕获异常更高效。

应用程序通常不需要 make_exception_ptr 函数,因此,我们不建议使用此函数。

请参见

参考

<exception>

在线程之间传输异常