Espacios de nombres
Variantes
Acciones

std::use_facet

De cppreference.com
< cpp‎ | locale
 
 
 
Definido en el archivo de encabezado <locale>
template< class Facet >
const Facet& use_facet( const std::locale& loc );
Obtiene una referencia a una faceta implementado por loc .
Original:
Obtains a reference to a facet implemented by loc.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

loc -
el objeto locale consultar
Original:
the locale object to query
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

Devuelve una referencia de la faceta. La referencia devuelta por esta función es válida siempre y cuando cualquier objeto que implemente std::locale existe Facet .
Original:
Returns a reference the facet. The reference returned by this function is valid as long as any std::locale object exists that implements Facet.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Excepciones

std::bad_cast if std::has_facet<Facet>(loc) == false.

[editar] Ejemplo

Muestra el nombre de la moneda de 3 letras utilizado por la configuración regional preferida del usuario
Original:
Display the 3-letter currency name used by the user's preferred locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <locale>
 
int main()
{
    std::locale loc = std::locale(""); // user's preferred locale
    std::cout << "Your currency string is "
              << std::use_facet<std::moneypunct<char, true>>(loc).curr_symbol() << '\n';
}

Salida:

Your currency string is USD

[editar] Ver también

Conjunto de facetas polimórficas que encapsulan las diferencias culturales.
(clase) [editar]
Comprueba si una configuración regional implementa una faceta específica.
(plantilla de función) [editar]