void clear() noexcept;
概要
エラー情報をクリアする
効果
エラー値を0、エラーカテゴリをgeneric_category()に初期化する。
戻り値
なし
例外
投げない
例
#include <iostream>
#include <system_error>
int main()
{
std::error_condition econd(static_cast<int>(std::errc::invalid_argument),
std::generic_category());
econd.clear();
if (econd) {
std::cout << "error" << std::endl;
}
else {
std::cout << "success" << std::endl;
}
std::cout << econd.value() << std::endl;
std::cout << econd.category().name() << std::endl;
}
出力
success
0
generic
バージョン
言語
- C++11
処理系
- Clang: ??
- GCC: 4.7.0 ✅
- ICC: ??
- Visual C++: 2010 ✅