命名空间
变体
操作

std::ctype<CharT>::~ctype

来自 cppreference.cn
< cpp‎ | 本地化‎ | ctype
 
 
 
 
 
定义于头文件 <locale>
protected: ~ctype();

销毁一个 std::ctype facet。此析构函数受保护且为虚函数(因为基类析构函数是虚函数)。一个 std::ctype 类型的对象,像大多数 facet 一样,只能在实现此 facet 的最后一个 std::locale 对象超出作用域时销毁,或者当用户定义的类继承自 std::ctype 并实现了一个公有析构函数时销毁。

[编辑] 示例

#include <iostream>
#include <locale>
 
struct Destructible_ctype : public std::ctype<wchar_t>
{
    Destructible_ctype(std::size_t refs = 0) : ctype(refs) {}
    // note: the implicit destructor is public
};
 
int main()
{
    Destructible_ctype dc;
    // std::ctype<wchar_t> c; // compile error: protected destructor
}