Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.12 KB

make_error_code.md

File metadata and controls

60 lines (44 loc) · 1.12 KB

#make_error_code

namespace std {
  error_code make_error_code(errc e) noexcept;
}
  • error_code[link ./error_code.md]
  • errc[link ./errc.md]

##概要 errc型の列挙値からerror_codeオブジェクトを生成する

##戻り値 error_code(static_cast<int>(e), generic_category())

##例外 投げない

##例

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

int main()
{
  std::error_code ec = std::make_error_code(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;
}
  • make_error_code[color ff0000]

###出力

category : generic
value : 22
message : Invalid argument

##バージョン ###言語

  • C++11

###処理系

##参照