std::make_error_condition(std::errc)
來自 cppreference.com
定義於標頭檔案 <system_error> |
||
std::error_condition make_error_condition( std::errc e ) noexcept; |
(C++11 起) | |
為 errc
值 e 建立一個錯誤條件。將錯誤值設定為 int(e),錯誤類別設定為 std::generic_category。
[編輯] 引數
e | - | 標準錯誤值 |
[編輯] 返回值
針對 e 的錯誤條件。
[編輯] 示例
執行此程式碼
#include <iostream> #include <string> #include <system_error> int main() { auto err = std::make_error_condition(std::errc::invalid_argument); std::cout << err.message() << '\n'; }
可能的輸出
Invalid argument