std::has_facet
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <locale>
|
||
template< class Facet > bool has_facet( const locale& loc ); |
||
Comprueba si el
loc locale implementa el Facet faceta .Original:
Checks if the locale
loc implements the facet Facet.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.
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. |
Valor de retorno
Regreso
true si la Facet faceta se instaló en el entorno local loc, false lo contrario .Original:
Returns
true if the facet Facet was installed in the locale loc, false otherwise.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.
Excepción especificación
Ejemplo
Ejecuta este código
#include <iostream>
#include <locale>
// minimal custom facet
struct myfacet : public std::locale::facet {
static std::locale::id id;
};
std::locale::id myfacet::id;
int main()
{
// loc is a "C" locale with myfacet added
std::locale loc(std::locale::classic(), new myfacet);
std::cout << std::boolalpha
<< "Can loc classify chars? "
<< std::has_facet<std::ctype<char>>(loc) << '\n'
<< "Can loc classify char32_t? "
<< std::has_facet<std::ctype<char32_t>>(loc) << '\n'
<< "Does loc implement myfacet? "
<< std::has_facet<myfacet>(loc) << '\n';
}
Salida:
Can loc classify chars? true
Can loc classify char32_t? false
Does loc implement myfacet? true
Ver también
| Conjunto de facetas polimórficas que encapsulan las diferencias culturales. (clase) | |
| Obtiene una faceta de una configuración regional. (plantilla de función) |