std::regex_error — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Déclaré dans l'en-tête <regex> |
||
|
|
(depuis C++11) | |
Définit le type d'objet jetés comme des exceptions pour signaler les erreurs provenant de la bibliothèque d'expressions régulières .
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.
Fonctions membres
construit un objet Original: constructs a The text has been machine-translated via Google Translate. (fonction membre publique) [edit] | |
obtient la std::regex_constants::error_type pour un Original: gets the std::regex_constants::error_type for a The text has been machine-translated via Google Translate. (fonction membre publique) [edit] | |
Inherited from std::exception
Member functions
[ virtuel Original: virtual The text has been machine-translated via Google Translate. |
Détruit l'objet exception Original: destructs the exception object The text has been machine-translated via Google Translate. (function membre virtuelle publique de std::exception) [edit]
|
[ virtuel Original: virtual The text has been machine-translated via Google Translate. |
retourne une chaîne explicative Original: returns an explanatory string The text has been machine-translated via Google Translate. (function membre virtuelle publique de std::exception) [edit]
|
Exemple
#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"; } }
Résultat :
regex_error caught: The expression contained mismatched [ and ]. The code was error_brack