Namespace
Varianti

std::num_put

Da cppreference.com.
< cpp‎ | locale

 
 
Localizzazioni libreria
Impostazioni internazionali e sfaccettature
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
Carattere classificazione
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.
Conversioni
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facet categoria classi di 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.
Facet categorie
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.
Locale specifici aspetti
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.
Codice di conversione sfaccettature
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
Membri funzioni
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;
Classe std::num_put incapsula le regole di formattazione per i valori di tipo bool, long, unsigned long, long long, unsigned long long, double, long double, void*, e di tutti i tipi convertibili in modo implicito a questi (come int o float), sotto forma di stringhe. Lo standard di formattazione operatori di uscita (ad esempio cout << n;) utilizzare l'aspetto del locale std::num_put I / O flusso di generare rappresentazione testuale dei numeri.
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
Informazioni sull'immagine

Inheritance diagram

Indice

[modifica] Tipo requisiti

-
OutputIt must meet the requirements of OutputIterator.

[modifica] Specializzazioni

Due specializzazioni e due specializzazioni parziali sono fornite dalla libreria standard e sono attuate da tutti gli oggetti delle impostazioni locali creati in un programma 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>
crea rappresentazioni di stringa di numeri stretti
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>
crea rappresentazioni di stringa di numeri grandi
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>
crea rappresentazioni di stringa di numeri stretti con iteratore di output personalizzato
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>
crea rappresentazioni di stringa a livello di numeri utilizzando iteratore di output personalizzato
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.

[modifica] Membri tipi

Membro tipo
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

[modifica] Membri funzioni

costruisce un nuovo aspetto 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.

(membro pubblico funzione)
distrugge un aspetto 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.

(protetto funzione membro)
Invoca 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.

(membro pubblico funzione)

[modifica] Protetto funzioni membro

[virtuale]
Formatta un numero e scrive al flusso di output
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.

(virtuale protetto funzione membro)

[modifica] Membri oggetti

static std::locale::id id
' Id del locale
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.

(membro oggetto pubblico)

[modifica] Esempio

#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

[modifica] Vedi anche

definisce le regole di punteggiatura numerici
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 template) [edit]
parses numeric values from an input character sequence
(classe template) [edit]
(C++11)
converte un valore in virgola mobile a integrale o 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.

(funzione) [edit]
converte un valore in virgola mobile a integrale o 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.

(funzione) [edit]