We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

regex_traits Class

Describes characteristics of elements for matching.

template<class Elem>
    struct regex_traits {

    static size_type length(const char_type *str);
    char_type translate(char_type ch) const;
    char_type translate_nocase(char_type ch) const;
    template<class FwdIt>
        string_type transform(FwdIt first, FwdIt last) const;
    template<class FwdIt>
        string_type transform_primary(FwdIt first, FwdIt last) const;
    template<class FwdIt>
        char_class_type lookup_classname(FwdIt first, FwdIt last) const;
    template<class FwdIt>
        string_type lookup_collatename(FwdIt first, FwdIt last) const;
    bool isctype(char_type ch, char_class_type cls) const;
    int value(Elem ch, int base) const;
    locale_type imbue(locale_type loc);
    locale_type getloc() const;

    typedef Elem char_type;
    typedef T6 size_type;
    typedef basic_string<Elem> string_type;
    typedef T7 locale_type;
    typedef T8 char_class_type;


The element type to describe.

The template class describes various regular expression traits for type Elem. The template class basic_regex Class uses this information to manipulate elements of type Elem.

Each regex_traits object holds an object of type regex_traits::locale which is used by some of its member functions. The default locale is a copy of regex_traits::locale(). The member function imbue replaces the locale object, and the member function getloc returns a copy of the locale object.

Header: <regex>

Namespace: std