std::money_get
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 InputIt = std::istreambuf_iterator<CharT> > class money_get; |
||
Vorlage Klasse
std::money_get kapselt die Regeln für das Parsen von monetären Werten von Charakter-Streams. Die Standard-I / O Manipulator std::get_money nutzt die std::money_get Facette des I / O-Streams locale .Original:
Class template
std::money_get encapsulates the rules for parsing monetary values from character streams. The standard I/O manipulator std::get_money uses the std::money_get facet of the I/O stream's locale.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
-InputIt must meet the requirements of InputIterator.
|
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::money_get<char>
|
analysiert engen String-Darstellungen der monetären Werte
Original: parses narrow string representations of monetary values The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
std::money_get<wchar_t>
|
analysiert breite Zeichenfolgendarstellungen von Geldwerten
Original: parses wide string representations of monetary values The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
std::money_get<char, InputIt>
|
analysiert engen String-Darstellungen von Geldwerten mit benutzerdefinierten Eingabe-Iterator
Original: parses narrow string representations of monetary values using custom input iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
std::money_get<wchar_t, InputIt>
|
analysiert breite Zeichenfolgendarstellungen monetäre Werte mithilfe von benutzerdefinierten Eingabe-Iterator
Original: parses wide string representations of monetary values using custom input 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
|
string_type
|
std::basic_string<CharT>
|
iter_type
|
InputIt
|
Member-Funktionen
baut eine neue money_get Facette Original: constructs a new money_get 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 money_get Facette Original: destructs a money_get 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_get Original: invokes do_get 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] |
parst einen monetären Wert von einer Input-Stream Original: parses a monetary value from an input 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 <sstream>
#include <locale>
#include <iomanip>
#include <iterator>
int main()
{
std::string str = "$1.11 $2.22 $3.33";
std::cout << std::fixed << std::setprecision(2);
std::cout << '"' << str << "\" parsed with the I/O manipulator: ";
std::istringstream s1(str);
s1.imbue(std::locale("en_US.UTF-8"));
long double val;
while(s1 >> std::get_money(val))
std::cout << val/100 << ' ';
std::cout << '\n';
str = "USD 1,234.56";
std::cout << '"' << str << "\" parsed with the facet directly: ";
std::istringstream s2(str);
s2.imbue(std::locale("en_US.UTF-8"));
auto& f = std::use_facet<std::money_get<char>>(s2.getloc());
std::ios_base::iostate err;
std::istreambuf_iterator<char> beg(s2), end;
f.get(beg, end, true, s2, err, val);
std::cout << val/100 << '\n';
}
Output:
"$1.11 $2.22 $3.33" parsed with the I/O manipulator: 1.11 2.22 3.33
"USD 1,234.56" parsed with the facet directly: 1234.56
Siehe auch
definiert Währungsformatierungsregeln Parameter std::money_get und std::money_put verwendet Original: defines monetary formatting parameters used by std::money_get and std::money_put The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Klassen-Template) | |
Formate einen monetären Wert für die Ausgabe als Zeichenfolge Original: formats a monetary value for output as a character sequence The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Klassen-Template) | |
(C++11) |
parst einen monetären Wert Original: parses a monetary value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) |