std::regex_traits<CharT>::isctype

Determines whether the character c belongs to the character class identified by f, which, in turn, is a value returned by lookup_classname() or a bitwise OR of several such values.

# Declarations

bool isctype( CharT c, char_class_type f ) const;

# Parameters

# Return value

true if c is classified by f, false otherwise.

# Example

#include <iostream>
#include <regex>
#include <string>
 
int main()
{
    std::regex_traits<char> t;
    std::string str_alnum = "alnum";
    auto a = t.lookup_classname(str_alnum.begin(), str_alnum.end());
    std::string str_w = "w"; // [:w:] is [:alnum:] plus '_'
    auto w = t.lookup_classname(str_w.begin(), str_w.end());
    std::cout << std::boolalpha
              << t.isctype('A', w) << ' ' << t.isctype('A', a) << '\n'
              << t.isctype('_', w) << ' ' << t.isctype('_', a) << '\n'
              << t.isctype(' ', w) << ' ' << t.isctype(' ', a) << '\n';
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2018C++11the value of m was unspecifiedmatches lookup_classname()’s minimal support

# See also