Пространства имён
Варианты
Действия

std::regex_error

Материал из cppreference.com

 
 
Библиотеки регулярных выражений
Классы
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_regex(C++11)
sub_match(C++11)
match_results(C++11)
Алгоритмы
Original:
Algorithms
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_match(C++11)
regex_search(C++11)
regex_replace(C++11)
Итераторы
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_iterator(C++11)
regex_token_iterator(C++11)
Исключения
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_error(C++11)
Черты
Original:
Traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_traits(C++11)
Константы
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
syntax_option_type(C++11)
match_flag_type(C++11)
error_type(C++11)
 
std::regex_error
Функции-члены
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
 
Заголовочный файл <regex>
class regex_error : public std::runtime_error {

  public:
    explicit regex_error(regex_constants::error_type ecode);
    regex_constants::error_type code() const;

};
(начиная с 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.

Содержание

[править] Член функций

строит 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.

(public функция-член) [edit]
получает std::regex_constants::error_type для 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.

(public функция-член) [edit]

Унаследован от std::exception

Member functions

[virtual]
разрушает объект исключения
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.

(virtual public std::exception функция-член) [edit]
[virtual]
возвращает пояснительной строкой
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.

(virtual public std::exception функция-член) [edit]

[править] Пример

#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