std::regex_error
提供: cppreference.com
                    
                                        
                    
                    
                                                            
                    |  | このページは、Google 翻訳を使って英語版から機械翻訳されました。 
 翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 | 
| Defined in header <regex>
  | ||
| class regex_error : public std::runtime_error {   public: | (C++11およびそれ以降) | |
正規表現ライブラリのエラーを報告するために、例外としてスローされたオブジェクトのタイプを定義します.
Original:
Defines the type of object thrown as exceptions to report errors from the regular expressions library.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| 目次 | 
[編集] メンバ関数
| regex_errorオブジェクトを作成しますOriginal:  constructs a  regex_errorobjectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
|  std::regex_constants::error_typeため regex_errorを取得しますOriginal:  gets the std::regex_constants::error_type for a  regex_errorThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
Inherited from std::exception
Member functions
| [仮想] |  例外オブジェクトを破棄します  Original:  destructs the exception object  The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception) | 
| [仮想] |  説明文字列を返します Original:  returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (仮想パブリックメンバ関数of std::exception) | 
[編集] 例
このコードを実行します
#include <regex> #include <iostream> int main() { try { std::regex re("[a-b][a"); } catch(const std::regex_error& e) { std::cout << "regex_error caught: " << e.what() << '\n'; if(e.code() == std::regex_constants::error_brack) std::cout << "The code was error_brack\n"; } }
出力:
regex_error caught: The expression contained mismatched [ and ]. The code was error_brack


