Espaces de noms
Variantes

std::num_put

De cppreference.com

<metanoindex/>

 
 
Bibliothèque localisations
Locales et facettes
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
Classification des caractères
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.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Classes de facettes catégorie de base
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.
Catégories de facettes
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.
Spécifique aux paramètres régionaux facettes
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.
Facettes de conversion de code
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 locale
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
Les fonctions membres
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
 
<tbody> </tbody>
Déclaré dans l'en-tête <locale>
template< class CharT, class OutputIt = std::ostreambuf_iterator<CharT> > class num_put;
Classe std::num_put encapsule les règles pour les valeurs de mise en forme de type bool, long, unsigned long, long long, unsigned long long, double, long double, void*, et de tous les types implicitement convertibles en ceux-ci (tels que int ou float), sous forme de chaînes. Les opérateurs standard de sortie de mise en forme (comme cout << n;) utiliser la facette std::num_put de la localisation du flux d'E / S à générer représentation textuelle d'un nombre .
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/facet

Inheritance diagram

Exigences de type

-
OutputIt must meet the requirements of OutputIterator.

Spécialisations

Deux spécialisations et deux spécialisations partielles sont fournies par la bibliothèque standard et sont mises en œuvre par tous les objets créés dans un environnement linguistique programme 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>
crée une chaine de caractères étroits de nombres
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>
crée une chaine de caractères larges de nombres
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>
crée une chaine de caractères étroits de nombres à l'aide itérateur de sortie personnalisé
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>
crée une chaine de caractères larges chiffres à l'aide itérateur de sortie personnalisé
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.

Types de membres

Type du membre Définition
char_type CharT
iter_type OutputIt

Fonctions membres

construit un nouveau 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.

(fonction membre publique)
Détruit une facette 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.

(fonction membre protégée)
Invoque 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.

(fonction membre publique)

Protégé fonctions membres

[
virtuel
Original:
virtual
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
Formate un nombre et écrit dans le flux de sortie
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.

(fonction membre virtuelle protégée)

Objets membres

static std::locale::id id
Id de la localisation
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.

(objet membre public)

Exemple

#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';
}

Résultat :

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

Voir aussi

définit les règles de ponctuation numériques
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.

(classe générique) [edit]
analyse des valeurs numériques à partir d'une séquence de caractères d'entrée
Original:
parses numeric values from an input character sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe générique) [edit]
(C++11)
convertit une valeur entière ou réelle en string
(fonction) [edit]
(C++11)
convertit une valeur de point intégrée ou flottante 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.

(fonction) [edit]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.