std::regex_error
Da cppreference.com
                    
                                        
                    
                    
                                                            
                    |  | This page has been machine-translated from the English version of the wiki using Google Translate. 
 The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. | 
| Defined in header <regex>
  | ||
| class regex_error : public std::runtime_error {   public: | (a partir do C++ 11) | |
Define o tipo de objeto lançado como exceções para relatar erros a partir da biblioteca de expressões regulares.
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.
| Índice | 
[editar] Funções de membro
|  constrói um objeto  regex_errorOriginal:  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. (função pública membro) | |
|  recebe o std::regex_constants::error_type para um  regex_errorOriginal:  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. (função pública membro) | |
Inherited from std::exception
Member functions
| [virtual] |  destrói o objeto de exceção  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::exceptionfunção pública virtual membro) | 
| [virtual] |  retorna uma cadeia explicativa 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::exceptionfunção pública virtual membro) | 
[editar] Exemplo
#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"; } }
Output:
regex_error caught: The expression contained mismatched [ and ]. The code was error_brack


