std::regex_error - cppreference.com
Espaços nominais
Variantes
Ações

std::regex_error

De cppreference.com

<metanoindex/>

 
 
Biblioteca de expressões regulares
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Algoritmos
Original:
Algorithms
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exceções
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Características
Original:
Traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
std::regex_error
Funções de membro
Original:
Member Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_error::regex_error
regex_error::code
 
<tbody> </tbody>
Definido no cabeçalho <regex>
class regex_error : public std::runtime_error { public: explicit regex_error(regex_constants::error_type ecode); regex_constants::error_type code() const; };
(desde 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.

Funções de membro

constrói um objeto regex_error
Original:
constructs a regex_error object
The 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) [edit]
recebe o std::regex_constants::error_type para um regex_error
Original:
gets the std::regex_constants::error_type for a regex_error
The 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) [edit]

Herdado de std::exception

Member functions

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";
    }
}

Saída:

regex_error caught: The expression contained mismatched [ and ].
The code was error_brack