STD::COLLATE_BYNAME(3cxx)

okay bestie, we're in std::collate_byname< _CharT >, manual section 3cxx, and it's giving byname collate class energy from <locale> πŸ’…βœ¨. No cap, every tiny detail is staying, so grab a strawberry πŸ“ and let's go.

πŸ’– NAME πŸ’–

std::collate_byname< _CharT > β€” the class collate_byname [22.2.4.2]. That's the whole name vibe. Periodt.

✨ SYNOPSIS ✨

#include <locale>

Inherits std::collate< _CharT >. Yes bestie, inherited energy πŸ‘‘.

🌸 Public Types 🌸

  • typedef _CharT char_type β€” public typedef, iconic.
  • typedef basic_string< _CharT > string_type β€” public typedef, also iconic.

πŸ’… Public Member Functions πŸ’…

Constructors, exactly:

  • collate_byname (const char *__s, size_t __refs=0)
  • collate_byname (const string &__s, size_t __refs=0)

The overloads, exactly:

  • int _M_compare (const _CharT *, const _CharT *) const throw ()
  • int _M_compare (const char *, const char *) const throw()
  • int _M_compare (const wchar_t *, const wchar_t *) const throw()
  • size_t _M_transform (_CharT *, const _CharT *, size_t) const throw ()
  • size_t _M_transform (char *, const char *, size_t) const throw()
  • size_t _M_transform (wchar_t *, const wchar_t *, size_t) const throw()

The main-character functions:

  • int compare (const _CharT *__lo1, const _CharT *__hi1, const _CharT *__lo2, const _CharT *__hi2) const β€” Compare two strings.
  • long hash (const _CharT *__lo, const _CharT *__hi) const β€” Return hash of a string.
  • string_type transform (const _CharT *__lo, const _CharT *__hi) const β€” Transform string to comparable form.

⭐ Static Public Attributes ⭐

  • static locale::id id β€” Numpunct facet id. (that's literally the description, bestie 😭).

πŸ›‘οΈ Protected Member Functions πŸ›‘οΈ

  • virtual int do_compare (const _CharT *__lo1, const _CharT *__hi1, const _CharT *__lo2, const _CharT *__hi2) const β€” Compare two strings.
  • virtual long do_hash (const _CharT *__lo, const _CharT *__hi) const β€” Return hash of a string.
  • virtual string_type do_transform (const _CharT *__lo, const _CharT *__hi) const β€” Transform string to comparable form.

🧚 Static Protected Member Functions 🧚

The source gives no extra blurb for these, so here are the exact signatures:

  • 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)

πŸ“ Protected Attributes πŸ“

  • __c_locale _M_c_locale_collate

πŸ¦‹ Detailed Description πŸ¦‹

Doxygen gives us this exact template/class line, and I'm preserving it character for character:

template<typename _CharT>
class std::collate_byname< _CharT >"class collate_byname [22.2.4.2].

That quote mark is in the original, bestie β€” I'm not fixing it, I'm keeping it 😭.

πŸŽ€ Member Typedef Documentation πŸŽ€

char_type

template<typename _CharT > typedef _CharT std::collate_byname< _CharT >::char_type

Public typedefs. That's the description. Slay.

string_type

template<typename _CharT > typedef basic_string<_CharT> std::collate_byname< _CharT >::string_type

Public typedefs. Same iconic public typedef energy πŸ’–.

πŸ”₯ Member Function Documentation πŸ”₯

compare β€” [inline], [inherited]

template<typename _CharT > int std::collate< _CharT >::compare (const _CharT * __lo1, const _CharT * __hi1, const _CharT * __lo2, const _CharT * __hi2) const

Compare two strings. This function compares two strings and returns the result by calling collate::do_compare().

Parameters

  • __lo1 β€” Start of string 1.
  • __hi1 β€” End of string 1.
  • __lo2 β€” Start of string 2.
  • __hi2 β€” End of string 2.

Returns 1 if string1 > string2, -1 if string1 < string2, else 0.


do_compare β€” [protected], [virtual], [inherited]

template<typename _CharT > int std::collate< _CharT >::do_compare (const _CharT * __lo1, const _CharT * __hi1, const _CharT * __lo2, const _CharT * __hi2) const

Compare two strings. This function is a hook for derived classes to change the value returned.

See also compare().

Parameters

  • __lo1 β€” Start of string 1.
  • __hi1 β€” End of string 1.
  • __lo2 β€” Start of string 2.
  • __hi2 β€” End of string 2.

Returns 1 if string1 > string2, -1 if string1 < string2, else 0.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::basic_string< _CharT, _Traits, _Alloc >::data(), and std::basic_string< _CharT, _Traits, _Alloc >::length().


do_hash β€” [protected], [virtual], [inherited]

template<typename _CharT > long std::collate< _CharT >::do_hash (const _CharT * __lo, const _CharT * __hi) const

Return hash of a string. This function computes and returns a hash on the input string. This function is a hook for derived classes to change the value returned.

Parameters

  • __lo β€” Start of string.
  • __hi β€” End of string.

Returns Hash value.


do_transform β€” [protected], [virtual], [inherited]

template<typename _CharT > collate< _CharT >::string_type std::collate< _CharT >::do_transform (const _CharT * __lo, const _CharT * __hi) const

Transform string to comparable form. This function is a hook for derived classes to change the value returned.

Parameters

  • __lo β€” Start.
  • __hi β€” End.

Returns transformed string.

References std::basic_string< _CharT, _Traits, _Alloc >::append(), std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::basic_string< _CharT, _Traits, _Alloc >::data(), std::basic_string< _CharT, _Traits, _Alloc >::length(), and std::basic_string< _CharT, _Traits, _Alloc >::push_back().


hash β€” [inline], [inherited]

template<typename _CharT > long std::collate< _CharT >::hash (const _CharT * __lo, const _CharT * __hi) const

Return hash of a string. This function computes and returns a hash on the input string. It does so by returning collate::do_hash().

Parameters

  • __lo β€” Start of string.
  • __hi β€” End of string.

Returns Hash value.


transform β€” [inline], [inherited]

template<typename _CharT > string_type std::collate< _CharT >::transform (const _CharT * __lo, const _CharT * __hi) const

Transform string to comparable form. This function is a wrapper for strxfrm functionality. It takes the input string and returns a modified string that can be directly compared to other transformed strings. In the C locale, this function just returns a copy of the input string. In some other locales, it may replace two chars with one, change a char for another, etc. It does so by returning collate::do_transform().

Parameters

  • __lo β€” Start of string.
  • __hi β€” End of string.

Returns Transformed string_type.

πŸ‘‘ Member Data Documentation πŸ‘‘

template<typename _CharT > locale::id std::collate< _CharT >::id

[static], [inherited] β€” Numpunct facet id. Yes, we're keeping that exact description again, bestie πŸ’€.

🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code.


🫢 that's the whole page, bestie. source/version: libstdc++, manual section 3cxx; date: not listed in the footer. Doxygen-generated from the source code, and we kept every detail. Bye bye πŸ’–βœ¨

πŸ“¦ where this page comes from