最終更新日時:
が更新

履歴 編集

function
<regex>

std::regex_error::コンストラクタ(C++11)

explicit regex_error(regex_constants::error_type ecode);

概要

エラーコードを受け取ってオブジェクトを構築する。

例

#include <regex>

int main()
{
  try {
    // 開き丸カッコに対応した閉じ丸カッコがない、というエラーコードの例外を送出
    throw std::regex_error(std::regex_constants::error_paren);
  }
  catch (const std::regex_error& e) {
    // コンストラクタで設定したエラーコードが取得できる
    std::regex_constants::error_type code = e.code();
  }
}

出力

バージョン

言語

  • C++11

処理系

  • Clang: 3.0 ✅, 3.1 ✅, 3.2 ✅, 3.3 ✅, 3.4 ✅, 3.5 ✅, 3.6 ✅
  • GCC: 4.9.0 ✅, 4.9.1 ✅, 5.0.0 ✅
  • Visual C++: ??