最終更新日時:
が更新

履歴 編集

class template
<locale>

std::time_put_byname

namespace std {
  template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
  class time_put_byname : public time_put<charT, OutputIterator>;
}

概要

time_put_bynameは、名前で指定したロケールの日時の出力を提供する、time_putの派生クラスである。

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

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

メンバ関数

publicメンバ関数

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

protectedメンバ関数

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

メンバ型

名前 説明
char_type 文字型 charT
iter_type 出力のイテレータ型 OutputIterator

#include <iostream>
#include <locale>

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

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

出力

true

バージョン

言語

  • C++98

関連項目