std::wbuffer_convert<Codecvt,Elem,Tr>::~wbuffer_convert
From cppreference.com
< cpp | locale | wbuffer convert
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
Localization library
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
std::wbuffer_convert
Member functions
wbuffer_convert::~wbuffer_convert
~wbuffer_convert();
Destroys the wbuffer_convert
object and deletes cvtptr
.
[edit] Notes
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 locale-independent facets from <codecvt>.
[edit] Example
Run this code
#include <codecvt> #include <iostream> #include <locale> #include <utility> // 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 ~wbuffer_convert" // std::wbuffer_convert<gbfacet_t, char32_t> // gbto32(std::cout.rdbuf(), 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::wbuffer_convert <gbfacet_t, char32_t> gbto32(std::cout.rdbuf(), new gbfacet_t("zh_CN.gb18030")); } // destructor called here
[edit] See also
destructs the
(public member function of
wstring_convert
and its conversion facet (public member function of
std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>
) [edit]