函式
<system_error>

std::make_error_condition

error_condition make_error_condition (errc e) noexcept;
建立錯誤條件
errc 列舉值 e(屬於 generic_category)建立 error_condition 物件。

它返回的結果與
1
error_condition(static_cast<int>(e),generic_category());

此函式由 error condition enum 型別的 error_condition 建構函式呼叫,並且應為所有自定義 error condition enum 型別過載,以便提供一種機制來從它們生成適當的 error_condition 物件。

標準庫為 io_errcfuture_errc 型別過載了此函式:參見 make_error_condition(io_errc)make_error_condition(future_errc)

引數

e
errc 型別的列舉值(參見 errc)。

返回值

代表列舉值 eerror_condition 物件。

示例

有關示例,請參見 error_category

另見