std::wstring_convert::~wstring_convert
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> ~wstring_convert(); |
||
Détruit l'objet
wstring_convert et supprime le pointeur sur la facette conversion .Original:
Destroys the
wstring_convert object and deletes the pointer to the conversion 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.
Notes
Certaines implémentations sont en mesure de supprimer toutes les facettes, y compris les aspects spécifiques de la localisation avec les destructeurs protégées. D'autres implémentations nécessitent la facette d'avoir un destructeur public, similaire à celle des paramètres régionaux indépendants facettes de
<codecvt>. C'est LWG issue 721Original:
Some implementations are able to delete any facet, including the locale-specific facets with protected destructors. Other implementations require the facet to have a public destructor, similar to the the locale-independent facets from
<codecvt>. This is LWG issue 721The 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.
Exemple
#include <locale>
#include <utility>
#include <codecvt>
// utility wrapper to adapt locale-bound facets for wstring/wbuffer convert
template<class Facet>
struct deletable_facet : Facet
{
template<class ...Args>
deletable_facet(Args&& ...args) : Facet(std::forward<Args>(args)...) {}
~deletable_facet() {}
};
int main()
{
// GB18030 / UCS4 conversion, using locale-based facet directly
// typedef std::codecvt_byname<char32_t, char, std::mbstate_t> gbfacet_t;
// Compiler error: "calling a protected destructor of codecvt_byname<> in ~wstring_convert"
// std::wstring_convert<gbfacet_t> gbto32(new gbfacet_t("zh_CN.gb18030"));
// GB18030 / UCS4 conversion facet using a facet with public destructor
typedef deletable_facet<std::codecvt_byname<char32_t, char, std::mbstate_t>> gbfacet_t;
std::wstring_convert<gbfacet_t> gbto32(new gbfacet_t("zh_CN.gb18030"));
} // destructor called here