STD::CTYPE_BYNAME(3)
π std::ctype_byname< _CharT > β Library Functions Manual π
okay bestie, welcome to std::ctype_byname< _CharT >(3) from the Library Functions Manual, and lemme tell you, this one is a whole moment. It's giving "C++ locale facet that knows its own name" and honestly? iconic. grab a boba, we're doing this together. π
β¨ NAME β¨
std::ctype_byname< _CharT > β the class ctype_byname [22.2.1.2]. yes that's the whole name section, she's concise, she's elegant, she's booked and busy. π
β¨ SYNOPSIS β¨
#include <locale>
Inherits std::ctype< _CharT >. so she's literally family, she inherited the whole wardrobe. π«Ά
β¨ Public Types β¨
typedef const int * __to_typetypedef _CharT char_typetypedef ctype< _CharT >::mask mask
β¨ Public Member Functions β¨
ctype_byname(const char *__s, size_t __refs=0)β constructor taking a C-string namectype_byname(const string &__s, size_t __refs=0)β constructor taking astringnameconst char_type * is(const char_type *__lo, const char_type *__hi, mask *__vec) constβ Return a mask array.bool is(mask __m, char_type __c) constβ Test char_type classification.char narrow(char_type __c, char __dfault) constβ Narrow char_type to char.const char_type * narrow(const char_type *__lo, const char_type *__hi, char __dfault, char *__to) constβ Narrow array to char array.const char_type * scan_is(mask __m, const char_type *__lo, const char_type *__hi) constβ Find char_type matching a mask.const char_type * scan_not(mask __m, const char_type *__lo, const char_type *__hi) constβ Find char_type not matching a mask.const char_type * tolower(char_type *__lo, const char_type *__hi) constβ Convert array to lowercase.char_type tolower(char_type __c) constβ Convert to lowercase.const char_type * toupper(char_type *__lo, const char_type *__hi) constβ Convert array to uppercase.char_type toupper(char_type __c) constβ Convert to uppercase.char_type widen(char __c) constβ Widen char to char_type.const char * widen(const char *__lo, const char *__hi, char_type *__to) constβ Widen array to char_type.
β¨ Static Public Attributes β¨
static const mask alnumstatic const mask alphastatic const mask blankstatic const mask cntrlstatic const mask digitstatic const mask graphstatic locale::id idβ the facet id forctype<char_type>. she has an ID, she's official. πͺͺstatic const mask lowerstatic const mask printstatic const mask punctstatic const mask spacestatic const mask upperstatic const mask xdigit
β¨ Protected Member Functions β¨
virtual const char_type * do_is(const char_type *__lo, const char_type *__hi, mask *__vec) constβ Return a mask array.virtual bool do_is(mask __m, char_type __c) constβ Test char_type classification.virtual char do_narrow(char_type, char __dfault) constβ Narrow char_type to char.virtual const char_type * do_narrow(const char_type *__lo, const char_type *__hi, char __dfault, char *__to) constβ Narrow char_type array to char.virtual const char_type * do_scan_is(mask __m, const char_type *__lo, const char_type *__hi) constβ Find char_type matching mask.virtual const char_type * do_scan_not(mask __m, const char_type *__lo, const char_type *__hi) constβ Find char_type not matching mask.virtual const char_type * do_tolower(char_type *__lo, const char_type *__hi) constβ Convert array to lowercase.virtual char_type do_tolower(char_type __c) constβ Convert to lowercase.virtual const char_type * do_toupper(char_type *__lo, const char_type *__hi) constβ Convert array to uppercase.virtual char_type do_toupper(char_type __c) constβ Convert to uppercase.virtual char_type do_widen(char __c) constβ Widen char.virtual const char * do_widen(const char *__lo, const char *__hi, char_type *__dest) constβ Widen char array.
β¨ Static Protected Member Functions β¨
static __c_locale _S_clone_c_locale(__c_locale &__cloc) throw ()static void _S_create_c_locale(__c_locale &__cloc, const char *__s, __c_locale __old=0)static void _S_destroy_c_locale(__c_locale &__cloc)static __c_locale _S_get_c_locale()static const char * _S_get_c_name() throw ()static __c_locale _S_lc_ctype_c_locale(__c_locale __cloc, const char *__s)
π¦ Detailed Description π¦
template<typename _CharT>
class std::ctype_byname< _CharT >
"class ctype_byname [22.2.1.2]." that's it. that's the whole vibe. she is what she says she is, no cap. π
π Member Function Documentation π
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_is(const char_type *__lo, const char_type *__hi, mask *__vec) const
[protected], [virtual], [inherited]
Return a mask array. This function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the input. like, don't be out here handing her a tiny vec, she will need exactly that many slots, periodt. β
do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input. consistency is the whole assignment, bestie.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.__vecβ Pointer to an array of mask storage.
Returns
__hi.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual bool std::ctype< _CharT >::do_is(mask __m, char_type __c) const
[protected], [virtual], [inherited]
Test char_type classification. This function finds a mask M for c and compares it to mask m.
do_is() is a hook for a derived facet to change the behavior of classifying. do_is() must always return the same result for the same input.
Parameters
__cβ The char_type to find the mask of.__mβ The mask to compare against.
Returns
(M & __m) != 0.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual char std::ctype< _CharT >::do_narrow(char_type __c, char __dfault) const
[protected], [virtual], [inherited]
Narrow char_type to char. This virtual function converts the argument to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. she's not doing the most, she's doing the simplest reasonable thing, and honestly? respect. π
do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.
Note: this is not what you want for codepage conversions. See codecvt for that. fr fr, wrong tool, put it down. π
Parameters
__cβ The char_type to convert.__dfaultβ Char to return if conversion fails.
Returns
The converted char.
Implements std::__ctype_abstract_base< _CharT >.
Referenced by std::ctype< char >::narrow(), and std::ctype< char >::narrow().
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_narrow(const char_type *__lo, const char_type *__hi, char __dfault, char *__to) const
[protected], [virtual], [inherited]
Narrow char_type array to char. This virtual function converts each char_type in the range [__lo,__hi) to char using the simplest reasonable transformation and writes the results to the destination array. For any element in the input that cannot be converted, __dfault is used instead.
do_narrow() is a hook for a derived facet to change the behavior of narrowing. do_narrow() must always return the same result for the same input.
Note: this is not what you want for codepage conversions. See codecvt for that.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.__dfaultβ Char to use if conversion fails.__toβ Pointer to the destination array.
Returns
__hi.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_scan_is(mask __m, const char_type *__lo, const char_type *__hi) const
[protected], [virtual], [inherited]
Find char_type matching mask. This function searches for and returns the first char_type c in [__lo,__hi) for which is(__m,c) is true. she's scanning the lineup looking for the one. π
do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.
Parameters
__mβ The mask to compare against.__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
Pointer to a matching char_type if found, else __hi.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_scan_not(mask __m, const char_type *__lo, const char_type *__hi) const
[protected], [virtual], [inherited]
Find char_type not matching mask. This function searches for and returns a pointer to the first char_type c of [lo,hi) for which is(m,c) is false. the opposite energy, we love a plot twist. π
do_scan_is() is a hook for a derived facet to change the behavior of match searching. do_is() must always return the same result for the same input.
Parameters
__mβ The mask to compare against.__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
Pointer to a non-matching char_type if found, else __hi.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_tolower(char_type *__lo, const char_type *__hi) const
[protected], [virtual], [inherited]
Convert array to lowercase. This virtual function converts each char_type in the range [__lo,__hi) to lowercase if possible. Other elements remain untouched. she's not touching what she doesn't have to touch, boundaries are healthy. π
do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
__hi.
Implements std::__ctype_abstract_base< _CharT >.
π§ template<typename _CharT> virtual char_type std::ctype< _CharT >::do_tolower(char_type __c) const
[protected], [virtual], [inherited]
Convert to lowercase. This virtual function converts the argument to lowercase if possible. If not possible (for example, '2'), returns the argument. yeah '2' said "I am who I am" and she respected that. π₯
do_tolower() is a hook for a derived facet to change the behavior of lowercasing. do_tolower() must always return the same result for the same input.
Parameters
__cβ The char_type to convert.
Returns
The lowercase char_type if convertible, else __c.
Implements std::__ctype_abstract_base< _CharT >.
Referenced by std::ctype< char >::tolower(), and std::ctype< char >::tolower().
π§ template<typename _CharT> virtual const char_type * std::ctype< _CharT >::do_toupper(char_type *__lo, const char_type *__hi) const
[protected], [virtual], [inherited]
Convert array to uppercase. This virtual function converts each char_type in the range [__lo,__hi) to uppercase if possible. Other elements remain untouched. SHE'S SHOUTING, BUT ONLY WHERE SHE'S ALLOWED TO. π£
do_toupper() is a hook for a derived facet to change the behavior of uppercasing. do_toupper() must always return the same result for the same input.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
__hi.
Implements std::__ctype_abstract_base< _CharT >.
π template<typename _CharT> virtual char_type std::ctype< _CharT >::do_toupper(char_type __c) const
[protected], [virtual], [inherited] β okay bestie, this one is the uppercase glow-up function.
This virtual function converts the char_type argument to uppercase if possible. If not possible (for example, '2'), returns the argument. no drama, it just hands it right back π
do_toupper() is a hook for a derived facet to change the behavior of uppercasing. And listen β do_toupper() must always return the same result for the same input. Consistency is the vibe, fr fr. π«Ά
Parameters
__cβ Thechar_typeto convert.
Returns
The uppercase char_type if convertible, else __c.
Implements std::__ctype_abstract_base< _CharT >.
Referenced by std::ctype< char >::toupper(), and std::ctype< char >::toupper().
β¨ template<typename _CharT> virtual char_type std::ctype< _CharT >::do_widen(char __c) const
[protected], [virtual], [inherited] β the widening one.
This virtual function converts the char to char_type using the simplest reasonable transformation. β¨
do_widen() is a hook for a derived facet to change the behavior of widening. Same rule as always: do_widen() must always return the same result for the same input. π§
Note: this is not what you want for codepage conversions. See codecvt for that. like, seriously bestie, wrong tool π
Parameters
__cβ Thecharto convert.
Returns
The converted char_type.
Implements std::__ctype_abstract_base< _CharT >.
Referenced by std::ctype< char >::widen(), and std::ctype< char >::widen().
π¦ template<typename _CharT> virtual const char * std::ctype< _CharT >::do_widen(const char * __lo, const char * __hi, char_type * __to) const
[protected], [virtual], [inherited] β the whole-array version, she does the group chat not the DM.
This function converts each char in the input to char_type using the simplest reasonable transformation. π
do_widen() is a hook for a derived facet to change the behavior of widening. And yes, do_widen() must always return the same result for the same input. periodt. π
Note: this is not what you want for codepage conversions. See codecvt for that.
Parameters
__loβ Pointer to start range.__hiβ Pointer to end of range.__toβ Pointer to the destination array.
Returns
__hi.
Implements std::__ctype_abstract_base< _CharT >.
πΈ template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::is(const char_type * __lo, const char_type * __hi, mask * __vec) const
[inline], [inherited] β return a mask array bestie.
This function finds the mask for each char_type in the range [lo,hi) and successively writes it to vec. vec must have as many elements as the char array. It does so by returning the value of ctype<char_type>::do_is().
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.__vecβ Pointer to an array of mask storage.
Returns
__hi.
π template<typename _CharT> bool std::__ctype_abstract_base< _CharT >::is(mask __m, char_type __c) const
[inline], [inherited] β the vibe check function. does this character match this mask? let's find out π
This function finds a mask M for __c and compares it to mask __m. It does so by returning the value of ctype<char_type>::do_is().
Parameters
__cβ Thechar_typeto compare the mask of.__mβ The mask to compare against.
Returns
(M & __m) != 0.
Referenced by std::time_get< _CharT, _InIter >::get().
π template<typename _CharT> char std::__ctype_abstract_base< _CharT >::narrow(char_type __c, char __dfault) const
[inline], [inherited] β narrowing a char_type down to a char. it's giving shrinkflation but make it intentional π
This function converts the char_type to char using the simplest reasonable transformation. If the conversion fails, dfault is returned instead. It does so by returning ctype<char_type>::do_narrow(__c).
Note: this is not what you want for codepage conversions. See codecvt for that. π
Parameters
__cβ Thechar_typeto convert.__dfaultβ Char to return if conversion fails.
Returns
The converted char.
Referenced by std::time_get< _CharT, _InIter >::do_get_year(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().
π template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::narrow(const char_type * __lo, const char_type * __hi, char __dfault, char * __to) const
[inline], [inherited] β narrow array to char array, the whole-squad edition.
This function converts each char_type in the input to char using the simplest reasonable transformation and writes the results to the destination array. For any char_type in the input that cannot be converted, __dfault is used instead. It does so by returning ctype<char_type>::do_narrow(__lo, __hi, __dfault, __to).
Note: this is not what you want for codepage conversions. See codecvt for that.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.__dfaultβ Char to use if conversion fails.__toβ Pointer to the destination array.
Returns
__hi.
π₯ template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::scan_is(mask __m, const char_type * __lo, const char_type * __hi) const
[inline], [inherited] β find a char_type matching a mask. scrolling until she finds the one β¨
This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is true. It does so by returning ctype<char_type>::do_scan_is().
Parameters
__mβ The mask to compare against.__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
Pointer to matching char_type if found, else __hi.
π template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::scan_not(mask __m, const char_type * __lo, const char_type * __hi) const
[inline], [inherited] β find a char_type not matching a mask. the contrarian search, iconic π
This function searches for and returns the first char_type c in [lo,hi) for which is(m,c) is false. It does so by returning ctype<char_type>::do_scan_not().
Parameters
__mβ The mask to compare against.__loβ Pointer to first char in range.__hiβ Pointer to end of range.
Returns
Pointer to non-matching char if found, else __hi.
π
template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::tolower(char_type * __lo, const char_type * __hi) const
[inline], [inherited] β convert array to lowercase. everyone in the range gets the soft girl treatment.
This function converts each char_type in the range [__lo,__hi) to lowercase if possible. Other elements remain untouched. It does so by returning ctype<char_type>:: do_tolower(__lo, __hi).
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
__hi.
π template<typename _CharT> char_type std::__ctype_abstract_base< _CharT >::tolower(char_type __c) const
[inline], [inherited] β convert to lowercase, single-char edition.
This function converts the argument to lowercase if possible. If not possible (for example, '2'), returns the argument. It does so by returning ctype<char_type>::do_tolower(c).
Parameters
__cβ Thechar_typeto convert.
Returns
The lowercase char_type if convertible, else __c.
Referenced by std::time_get< _CharT, _InIter >::get().
π template<typename _CharT> const char_type * std::__ctype_abstract_base< _CharT >::toupper(char_type * __lo, const char_type * __hi) const
[inline], [inherited] β convert array to uppercase. main character energy for the whole range π
This function converts each char_type in the range [lo,hi) to uppercase if possible. Other elements remain untouched. It does so by returning ctype<char_type>:: do_toupper(lo, hi).
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.
Returns
__hi.
β template<typename _CharT> char_type std::__ctype_abstract_base< _CharT >::toupper(char_type __c) const
[inline], [inherited] β convert to uppercase. one character, one glow-up.
This function converts the argument to uppercase if possible. If not possible (for example, '2'), returns the argument. It does so by returning ctype<char_type>::do_toupper().
Parameters
__cβ Thechar_typeto convert.
Returns
The uppercase char_type if convertible, else __c.
Referenced by std::time_get< _CharT, _InIter >::get().
π¦ template<typename _CharT> char_type std::__ctype_abstract_base< _CharT >::widen(char __c) const
[inline], [inherited] β widen char to char_type.
This function converts the char argument to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).
Note: this is not what you want for codepage conversions. See codecvt for that.
Parameters
__cβ Thecharto convert.
Returns
The converted char_type.
Referenced by std::money_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::money_put< _CharT, _OutIter >::do_put(), and std::time_put< _CharT, _OutIter >::do_put().
πΈ template<typename _CharT> const char * std::__ctype_abstract_base< _CharT >::widen(const char * __lo, const char * __hi, char_type * __to) const
[inline], [inherited] β widen array to char_type. bringing the whole friend group along π«Ά
This function converts each char in the input to char_type using the simplest reasonable transformation. It does so by returning ctype<char_type>::do_widen(c).
Note: this is not what you want for codepage conversions. See codecvt for that.
Parameters
__loβ Pointer to start of range.__hiβ Pointer to end of range.__toβ Pointer to the destination array.
Returns
__hi.
π MEMBER DATA DOCUMENTATION π
π template<typename _CharT> locale::id std::ctype< _CharT >::id
[static], [inherited] β The facet id for ctype<char_type>. her little name tag at the party π
βοΈ AUTHOR βοΈ
Generated automatically by Doxygen for libstdc++ from the source code. like, she didn't hand-write this herself, the robots did it and honestly? ate. π
okay bestie that's a wrap on std::ctype...e< _CharT >(3) π this whole page lives in the libstdc++ corner of the world, straight out of the source code, and the page footer is literally just libstdc++ + std::ctype...e< _CharT >(3) β the classic libstdc++ flex. go forth and classify some characters, you got this. no cap. πβ¨
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms