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

履歴 編集

function
<system_error>

std::make_error_condition(C++11)

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

概要

errc型の列挙値からerror_conditionオブジェクトを生成する

戻り値

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

例外

投げない

#include <iostream>
#include <system_error>
#include <string>

int main()
{
  std::error_condition ec = std::make_error_condition(std::errc::invalid_argument);

  std::cout << "category : " << ec.category().name() << std::endl;
  std::cout << "value : " << ec.value() << std::endl;
  std::cout << "message : " << ec.message() << std::endl;
}

出力

category : generic
value : 22
message : Invalid argument

バージョン

言語

  • C++11

処理系

参照