Sdílet prostřednictvím


regex_error – třída

Nahlásí chybný objekt basic_regex.

Syntaxe

class regex_error
: public std::runtime_error

Poznámky

Třída popisuje objekt výjimky vyvolaný k hlášení chyby při konstrukci nebo použití objektu basic_regex .

Konstruktory

Konstruktor Popis
regex_error Vytvoří objekt.

Členské funkce

Členová funkce Popis
kód Vrátí kód chyby.

Požadavky

Header:<regex>

Namespace: std

Příklad

// std__regex__regex_error.cpp
// compile with: /EHsc
#include <regex>
#include <iostream>

int main()
    {
    std::regex_error paren(std::regex_constants::error_paren);

    try
        {
        std::regex rx("(a");
        }
    catch (const std::regex_error& rerr)
        {
        std::cout << "regex error: "
            << (rerr.code() == paren.code() ? "unbalanced parentheses" : "")
            << std::endl;
        }
    catch (...)
        {
        std::cout << "unknown exception" << std::endl;
        }

    return (0);
    }
regex error: unbalanced parentheses

regex_error::code

Vrátí kód chyby.

regex_constants::error_code code() const;

Poznámky

Členská funkce vrátí hodnotu, která byla předána konstruktoru objektu.

regex_error::regex_error

Vytvoří objekt.

regex_error(regex_constants::error_code error);

Parametry

chyba
Kód chyby.

Poznámky

Konstruktor vytvoří objekt, který obsahuje chybu hodnoty.

Viz také

<regex>
regex_constants – třída
<funkce regulárních výrazů>
regex_iterator – třída
<Operátory regulárních výrazů>
regex_token_iterator – třída
regex_traits – třída
<regex> typedefs