std::ctype_byname

Header: <locale>

std::ctype_byname is a std::ctype facet which encapsulates character classification rules of the locale specified at its construction.

# Declarations

template< class CharT >
class ctype_byname : public std::ctype<CharT>;

# Parameters

# Notes

std::ctype_byname was incorrectly declared as an explicit specialization in the synopsis of , and the declaration was removed by the resolution of LWG issue 1298, but it remains a required specialization, just like std::ctype_byname<wchar_t>.

# Example

#include <iostream>
#include <locale>
 
int main()
{
    wchar_t c = L'\u00de'; // capital letter thorn
 
    std::locale loc("C");
 
    std::cout << "isupper('Þ', C locale) returned "
              << std::boolalpha << std::isupper(c, loc) << '\n';
 
    loc = std::locale(loc, new std::ctype_byname<wchar_t>("en_US.utf8"));
 
    std::cout << "isupper('Þ', C locale with Unicode ctype) returned "
              << std::boolalpha << std::isupper(c, loc) << '\n';
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 16C++98the definition of the explicit specialization std::ctype_bynamemisspecified the name and parameter list of do_narrowcorrected
LWG 616C++98the typename disambiguator was missing in the definition of maskadded

# See also