Skip to content

Latest commit

 

History

History
70 lines (53 loc) · 1.53 KB

make_error_condition.md

File metadata and controls

70 lines (53 loc) · 1.53 KB

make_error_condition

  • system_error[meta header]
  • std[meta namespace]
  • function[meta id-type]
  • cpp11[meta cpp]
namespace std {
  error_condition make_error_condition(errc e) noexcept;
}
  • error_condition[link error_condition.md]
  • errc[link errc.md]

概要

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;
}
  • std::make_error_condition[color ff0000]
  • std::error_condition[link error_code.md]
  • std::errc::invalid_argument[link errc.md]
  • ec.category()[link error_condition/category.md]
  • name()[link error_category/name.md]
  • ec.value()[link error_condition/value.md]
  • ec.message()[link error_condition/message.md]

出力

category : generic
value : 22
message : Invalid argument

バージョン

言語

  • C++11

処理系

参照