名前空間
変種

std::time_put

提供: cppreference.com
 
 
 
 
<tbody> </tbody>
ヘッダ <locale> で定義
template< class CharT, class OutputIt = std::ostreambuf_iterator<CharT> > class time_put;

クラステンプレート std::time_put は日付と時間の書式化ルールをカプセル化します。 入出力マニピュレータ std::put_timestd::tm オブジェクトのテキスト表現を生成するために入出力ストリームのロケールの std::time_put ファセットを使用します。

cpp/locale/time basecpp/locale/locale/facet

継承図

型の要件

-
OutputItLegacyOutputIterator の要件を満たさなければなりません。

特殊化

2つのスタンドアロンな (ロケール非依存な) 完全特殊化および2つの部分特殊化が標準ライブラリによって提供されます。

ヘッダ <locale> で定義
std::time_put<char> 日付と時間のナロー文字列表現を作成します
std::time_put<wchar_t> 日付と時間のワイド文字列表現を作成します
std::time_put<char, OutputIt> カスタム出力イテレータを用いて日付と時間のナロー文字列表現を作成します
std::time_put<wchar_t, OutputIt> カスタム出力イテレータを用いて日付と時間のワイド文字列表現を作成します

さらに、 C++ のプログラム内で構築されたすべてのロケールオブジェクトは、これらの特殊化の独自の (ロケール固有の) バージョンを実装します。

メンバ型

メンバ型 定義
char_type CharT
iter_type OutputIt

メンバ関数

新しい time_put ファセットを構築します
(パブリックメンバ関数) [edit]
time_put ファセットを破棄します
(プロテクテッドメンバ関数) [edit]
do_put を呼びます
(パブリックメンバ関数) [edit]

メンバオブジェクト

static std::locale::id id
ロケールの id
(パブリックメンバオブジェクト)

プロテクテッドメンバ関数

[仮想]
日付/時間を書式化し出力ストリームに書き込みます
(仮想プロテクテッドメンバ関数) [edit]

#include <iostream>
#include <ctime>
#include <iomanip>
#include <codecvt>

int main()
{
    std::time_t t = std::time(NULL);
    std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv(std::cout.rdbuf());
    std::wostream out(&conv);
    out.imbue(std::locale("ja_JP.utf8"));
    // this I/O manipulator std::put_time uses std::time_put<wchar_t>
    out << std::put_time(std::localtime(&t), L"%A %c") << '\n';
}

出力:

水曜日 2011年11月09日 12時32分05秒

関連項目

指定された名前のロケールに対するシステム供給の std::time_put を表します
(クラステンプレート) [edit]
入力文字シーケンスから時刻/日付の値をパースして struct std::tm に変換します
(クラステンプレート) [edit]
(C++11)
指定された書式に従って日付/時刻の値をフォーマットして出力します
(関数テンプレート) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.