Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::collate_byname

      From cppreference.com
      <cpp‎ |locale
       
       
       
      Localization library
       
      Defined in header<locale>
      template<class CharT>
      class collate_byname:publicstd::collate<CharT>;

      std::collate_byname is astd::collate facet which encapsulates locale-specific collation (comparison) and hashing of strings. Just likestd::collate, it can be imbued instd::regex and applied, by means ofstd::locale::operator(), directly to all standard algorithms that expect a string comparison predicate.

      Contents

      [edit]Specializations

      The standard library is guaranteed to provide the following specializations:

      Defined in header<locale>
      std::collate_byname<char> locale-specific collation of multibyte strings
      std::collate_byname<wchar_t> locale-specific collation of wide strings

      [edit]Member functions

      (constructor)
      constructs a newcollate_byname facet
      (public member function)[edit]
      (destructor)
      destroys acollate_byname facet
      (protected member function)[edit]
      [edit]

      std::collate_byname::collate_byname

      explicit collate_byname(constchar* name,std::size_t refs=0);
      explicit collate_byname(conststd::string& name,std::size_t refs=0);
      (since C++11)

      Constructs a newstd::collate_byname facet for a locale withname.

      refs is used for resource management: ifrefs==0, the implementation destroys the facet, when the laststd::locale object holding it is destroyed. Otherwise, the object is not destroyed.

      Parameters

      name - the name of the locale
      refs - the number of references that link to the facet
      [edit]

      std::collate_byname::~collate_byname

      protected:
      ~collate_byname();

      Destroys the facet.

      Inherited fromstd::collate

      Nested types

      Type Definition
      char_typeCharT
      string_typestd::basic_string<CharT>

      [edit]Data members

      Member Description
      std::locale::idid[static] the identifier of thefacet

      Member functions

      invokesdo_compare
      (public member function ofstd::collate<CharT>)[edit]
      invokesdo_transform
      (public member function ofstd::collate<CharT>)[edit]
      invokesdo_hash
      (public member function ofstd::collate<CharT>)[edit]

      Protected member functions

      [virtual]
      compares two strings using this facet's collation rules
      (virtual protected member function ofstd::collate<CharT>)[edit]
      [virtual]
      transforms a string so that collation can be replaced by comparison
      (virtual protected member function ofstd::collate<CharT>)[edit]
      [virtual]
      generates an integer hash value using this facet's collation rules
      (virtual protected member function ofstd::collate<CharT>)[edit]

      [edit]Notes

      Collation order is the dictionary order: the position of the letter in the national alphabet (itsequivalence class) has higher priority than its case or variant. Within an equivalence class, lowercase characters collate before their uppercase equivalents and locale-specific order may apply to the characters with diacritics. In some locales, groups of characters compare as singlecollation units. For example,"ch" in Czech follows"h" and precedes"i", and"dzs" in Hungarian follows"dz" and precedes"g".

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      defines lexicographical comparison and hashing of strings
      (class template)[edit]
      compares two strings in accordance to the current locale
      (function)[edit]
      compares two wide strings in accordance to the current locale
      (function)[edit]
      lexicographically compares two strings using this locale's collate facet
      (public member function ofstd::locale)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/locale/collate_byname&oldid=177984"

      [8]ページ先頭

      ©2009-2025 Movatter.jp