• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <ios>

    std::iostream_category

    namespace std {
      const error_category& iostream_category();          // C++11
      const error_category& iostream_category() noexcept; // C++14
    }
    

    概要

    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;
    }
    

    出力例

    iostream
    iostream stream error
    

    バージョン

    言語

    • C++11

    処理系

    参照