名前空間
変種
操作

std::num_put

提供: cppreference.com
< cpp‎ | locale

 
 
ローカライゼーションライブラリ
ロケールおよびファセット
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
文字分類
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
変換
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリの基底クラスです
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファセットカテゴリ
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ロケール固有のファセット
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
コー​​ド変換ファセット
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8(C++11)
codecvt_utf16(C++11)
Cロケール
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::num_put
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
num_put::num_put
num_put::~num_put
num_put::put
num_put::do_put
 
Defined in header <locale>
template<

    class CharT,
    class OutputIt = std::ostreambuf_iterator<CharT>

> class num_put;
クラスはstd::num_putboollongunsigned longlong longunsigned long longdoublelong doublevoid*、これらの(例えばintとして、またはfloat)、文字列などに暗黙的に変換可能なすべての種類の型の値をフォーマットするための規則をカプセル化しています。標準フォーマットの出力演算子は(例えばcout << n;AS)番号のテキス​​ト表現を生成するために、I / Oストリームのロケールのstd::num_putファセットを使用し.
Original:
Class std::num_put encapsulates the rules for formatting values of type bool, long, unsigned long, long long, unsigned long long, double, long double, void*, and of all types implicitly convertible to these (such as int or float), as strings. The standard formatting output operators (such as cout << n;) use the std::num_put facet of the I/O stream's locale to generate text representation of numbers.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cpp/locale/locale/facetstd-num put-inheritance.svg
画像の詳細

Inheritance diagram

目次

[編集] 型の要件

-
OutputIt must meet the requirements of OutputIterator.

[編集] スペシャ

2つの専門分野と2部分的な特殊化は、標準ライブラリによって提供されており、C + +プログラムで作成されたすべてのロケール·オブジェクトによって実装されます
Original:
Two specializations and two partial specializations are provided by the standard library and are implemented by all locale objects created in a C++ program:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Defined in header <locale>
std::num_put<char>
数字の狭い文字列表現を作成します
Original:
creates narrow string representations of numbers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::num_put<wchar_t>
数字のワイド文字列表現を作成します
Original:
creates wide string representations of numbers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::num_put<char, OutputIt>
カスタム出力イテレータを使用して数値の狭い文字列表現を作成します
Original:
creates narrow string representations of numbers using custom output iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::num_put<wchar_t, OutputIt>
カスタム出力イテレータを使用して数値のワイド文字列表現を作成します
Original:
creates wide string representations of numbers using custom output iterator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] メンバータイプ

メンバー·タイプ
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
char_type CharT
iter_type OutputIt

[編集] メンバ関数

新しいnum_putファセットを構築します
Original:
constructs a new num_put facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数)
num_putファセットを破棄します
Original:
destructs a num_put facet
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(メンバー関数を保護しました)
do_putを呼び出します
Original:
invokes do_put
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数)

[編集] メンバ関数を保護しました

[仮想]
形式番号と出力ストリームに書き込みます
Original:
formats a number and writes to output stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(仮想protectedメンバ関数)

[編集] メンバーオブジェクト

static std::locale::id id
idはロケールの
Original:
id of the locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバオブジェクト)

[編集]

#include <iostream>
#include <locale>
#include <string>
#include <iterator>
 
int main()
{
    double n = 1234567.89;
    std::cout.imbue(std::locale("de_DE"));
    std::cout << "Direct conversion to string:\n"
              << std::to_string(n) << '\n'
              << "Output using a german locale:\n"
              << std::fixed << n << '\n'
              << "Output using an american locale:\n";
    // use the facet directly
    std::cout.imbue(std::locale("en_US.UTF-8"));
    auto& f = std::use_facet<std::num_put<char>>(std::cout.getloc());
    f.put(std::ostreambuf_iterator<char>(std::cout), std::cout, ' ', n);
    std::cout << '\n';
}

Output:

Direct conversion to string:
1234567.890000
Output using a german locale:
1.234.567,890000
Output using an american locale:
1,234,567.890000

[編集] も参照してください

数値の区切り文字の規則を定義します
Original:
defines numeric punctuation rules
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(クラステンプレート) [edit]
parses numeric values from an input character sequence
(クラステンプレート) [edit]
(C++11)
stringに整数型または浮動小数点値に変換します
Original:
converts an integral or floating point value to string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
wstringに整数型または浮動小数点値に変換します
Original:
converts an integral or floating point value to wstring
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]