X Tutup
The Wayback Machine - https://web.archive.org/web/20180621094910/http://ja.cppreference.com:80/w/cpp/error/generic_category
名前空間
変種
操作

std::generic_category

提供: cppreference.com
< cpp‎ | error

 
 
 
 
ヘッダ <system_error> で定義
const std::error_category& generic_category();
(C++11およびそれ以降)
一般的なエラーのための静的なエラーカテゴリオブジェクトへの参照を取得します。オブジェクトは、文字列error_category::name()へのポインタを返す仮想関数"generic"をオーバーライドする必要があります。それはPOSIXerrnoコードに対応するエラー条件を識別するために使用され.
Original:
Obtains a reference to the static error category object for generic errors. The object is required to override the virtual function error_category::name() to return a pointer to the string "generic". It is used to identify error conditions that correspond to the POSIX errno codes.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

(なし)

[編集] 値を返します

std::error_category由来不特定の実行時の型の静的オブジェクトへの参照.
Original:
A reference to the static object of unspecified runtime type, derived from std::error_category.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 例外

noexcept 指定:  
noexcept
  

[編集]

#include <iostream>
#include <system_error>
#include <cerrno>
#include <string>
int main()
{
    std::error_condition econd = std::generic_category().default_error_condition(EDOM);
    std::cout << "Category: " << econd.category().name() << '\n'
              << "Value: " << econd.value() << '\n'
              << "Message: " << econd.message() << '\n';
}

出力:

Category: generic
Value: 33
Message: Numerical argument out of domain

[編集] 参照

オペレーティングシステムのエラーカテゴリを識別します
(関数) [edit]
(C++11)
標準の <cerrno> のマクロ定数をすべて並べた std::error_condition 用の列挙型
(クラス) [edit]
X Tutup