Espacios de nombres
Variantes
Acciones

std::num_put

De cppreference.com
< cpp‎ | locale

 
 
Localizaciones biblioteca
Locales y facetas
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
Carácter clasificación
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.
Conversiones
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 clases categoría 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.
Categorías faceta
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.
Específico de la localidad facetas
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.
Facetas código de conversión
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
Las funciones miembro
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;
Clase std::num_put encapsula las reglas para los valores de formato de tipo bool, long, unsigned long, long long, unsigned long long, double, long double, void*, y de todos los tipos implícitamente convertibles en ellas (como int o float), como cadenas. Los operadores de formato de salida estándar (como cout << n;) utilizan la faceta std::num_put de la configuración regional del flujo de I / O para generar la representación de texto de los números .
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
Acerca de esta imagen

Inheritance diagram

Contenido

[editar] Tipo de requisitos

-
OutputIt must meet the requirements of OutputIterator.

[editar] Especializaciones

Dos especializaciones y dos especializaciones parciales son proporcionados por la biblioteca estándar y son aplicadas por todos los objetos creados en un entorno nacional C + + programa:
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 representaciones estrechas cadenas de números
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 representaciones de ancho de cadena de números
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 representaciones estrechas cadena de números usando iterador de salida personalizado
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 representaciones de ancho de cadena de números con iterador de salida personalizado
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.

[editar] Tipos de miembros

Miembro de 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

[editar] Las funciones miembro

construye una nueva faceta 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.

(miembro público función)
destructs una faceta 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.

(protegidos función miembro)
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.

(miembro público función)

[editar] Protegido funciones miembro

[virtual]
da formato a un número y escribe a la corriente de salida
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.

(virtuales protegidos miembro de función)

[editar] Objetos miembros

static std::locale::id id
Identificador de la configuración regional
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.

(objeto miembro del público)

[editar] Ejemplo

#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

[editar] Ver también

define las reglas numéricas de puntuación
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.

(clase de plantilla) [edit]
parses numeric values from an input character sequence
(clase de plantilla) [edit]
(C++11)
Convierte un valor de coma flotante o integral a 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.

(función) [edit]
Convierte un valor de coma flotante o integral a 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.

(función) [edit]