共用方式為


make_exception_ptr

建立持有例外狀況複本的 exception_ptr 物件。

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

參數

  • Except
    具有待複製例外狀況的類別。 雖然任何類別物件都可以是 make_exception_ptr 函式的引數,但一般會指定 exception 類別物件做為其引數。

傳回值

exception_ptr 物件,指向 Except 的目前例外狀況複本。

備註

呼叫 make_exception_ptr 函式相當於擲回 C++例外狀況,在 catch 區塊中攔截例外狀況,然後呼叫 current_exception 函式以傳回參考例外狀況的 exception_ptr 物件。 Microsoft 實作的make_exception_ptr 函式比在擲回例外狀況之後攔截來得更有效率。

一般來說,應用程式通常不需要使用 make_exception_ptr 函式,所以我們不建議使用此功能。

請參閱

參考

<exception>

在執行緒之間傳輸例外狀況