std::num_put
Aus cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| definiert in Header <locale>
|
||
template< class CharT, class OutputIt = std::ostreambuf_iterator<CharT> > class num_put; |
||
Klasse
std::num_put kapselt die Regeln für die Formatierung von Werten vom Typ bool, long, unsigned long, long long, unsigned long long, double, long double, void* und aller Arten implizit konvertierbar diese (wie int oder float), als Zeichenfolgen. Die Standard-Formatierung ausgegeben Operatoren (wie cout << n;) die std::num_put Facette des I / O-Streams locale Text Darstellung von Zahlen zu erzeugen .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.
You can help to correct and verify the translation. Click here for instructions.
Inheritance diagram
Type Anforderungen
-OutputIt must meet the requirements of OutputIterator.
|
Spezialisierungen
Zwei Spezialisierungen und zwei partielle Spezialisierungen werden durch die Standard-Bibliothek zur Verfügung gestellt und werden von allen locale Objekte in einem C + +-Programm erstellt implementiert:
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.
You can help to correct and verify the translation. Click here for instructions.
definiert in Header
<locale> | |
std::num_put<char>
|
erzeugt eine enge String-Darstellungen von Zahlen
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>
|
schafft große String-Darstellungen von Zahlen
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>
|
erzeugt eine enge String-Darstellungen von Zahlen mithilfe von benutzerdefinierten Ausgabeiterator
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>
|
schafft große String-Darstellungen von Zahlen mithilfe von benutzerdefinierten Ausgabeiterator
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. |
Mitglied Typen
Mitglied Typ
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
|
Member-Funktionen
baut eine neue num_put Facette 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. (öffentliche Elementfunktion) | |
zerstört sich eine num_put Facette 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. (geschützt Member-Funktion) | |
Beruft 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. (öffentliche Elementfunktion) | |
Geschützt Member-Funktionen
[virtuell] |
formatiert eine Zahl und schreibt die Ausgabe-Stream 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. (virtuellen geschützten Member-Funktion) |
Mitglied widerspricht
static std::locale::id id |
ID des Gebietsschemas 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. (öffentliche Member-Objekt) |
Beispiel
#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
Siehe auch
definiert numerische Satzzeichen Regeln 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. (Klassen-Template) | |
| parses numeric values from an input character sequence (Klassen-Template) | |
(C++11) |
wandelt ein integrierter oder Gleitkommawert 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. (Funktion) |
(C++11) |
wandelt ein integrierter oder Gleitkommawert 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. (Funktion) |