最終更新日時:
が更新

履歴 編集

class template
<locale>

std::collate_byname

namespace std {
  template <class charT>
  class collate_byname : public collate<charT>;
}

概要

collate_bynameは、名前で指定したロケールの文字列の照合を提供する、collateの派生クラスである。

collateの仮想関数を、locale(const char*)で同じ名前を指定して構築したロケールのファセットと等価な意味論で実装する。

このクラスはcollateが提供するインタフェースをそのまま継承しており、独自のメンバ関数は持たない。

メンバ関数

publicメンバ関数

名前 説明
(constructor) コンストラクタ

protectedメンバ関数

名前 説明
(destructor) デストラクタ

メンバ型

名前 説明
string_type 文字列型 std::basic_string<charT>

#include <iostream>
#include <locale>

int main()
{
  // ファセットのデストラクタはprotectedであるため、
  // newで確保してlocaleに所有権を渡す
  std::locale loc{std::locale::classic(), new std::collate_byname<char>{"C"}};

  std::cout << std::boolalpha
            << std::has_facet<std::collate<char>>(loc) << std::endl;
}

出力

true

バージョン

言語

  • C++98

関連項目