Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 2.23 KB

iostream_category.md

File metadata and controls

71 lines (53 loc) · 2.23 KB

iostream_category

  • ios[meta header]
  • std[meta namespace]
  • function[meta id-type]
  • cpp11[meta cpp]
namespace std {
  const error_category& iostream_category();          // C++11
  const error_category& iostream_category() noexcept; // C++14
}
  • error_category[link /reference/system_error/error_category.md]

概要

io_errcのためのエラーカテゴリを取得する。

戻り値

error_categoryクラスを継承したクラスオブジェクトへの参照を返す。 この関数を呼び出すことによって返されるオブジェクトは、同じオブジェクトを指す。

この関数によって返されるオブジェクトのクラスは以下の特徴を持つ:

例外

投げない

#include <iostream> // 自動的に<ios>もインクルードされる
#include <string>

int main()
{
  const std::error_category& cat = std::iostream_category();

  std::cout << cat.name() << std::endl;
  std::cout << cat.message(static_cast<int>(std::io_errc::stream)) << std::endl;
}
  • std::iostream_category[color ff0000]
  • std::error_category[link /reference/system_error/error_category.md]
  • cat.name()[link /reference/system_error/error_category/name.md]
  • cat.message[link /reference/system_error/error_category/message.md]
  • std::io_errc::stream[link io_errc.md]

出力例

iostream
iostream stream error

バージョン

言語

  • C++11

処理系

参照