• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <future>

    std::make_error_condition

    namespace std {
      error_condition make_error_condition(future_errc e) noexcept;
    }
    

    概要

    future_errcからerror_conditionを生成する

    戻り値

    error_condition(static_cast<int>(e), future_category())

    例外

    投げない

    #include <iostream>
    #include <future>
    #include <string>
    
    int main()
    {
      std::error_condition ec = std::make_error_condition(std::future_errc::broken_promise);
    
      std::cout << "category : " << ec.category().name() << std::endl;
      std::cout << "value : " << ec.value() << std::endl;
      std::cout << "message : " << ec.message() << std::endl;
    }
    

    出力例

    category : future
    value : 4
    message : Broken promise
    

    バージョン

    言語

    • C++11

    処理系

    参照