命名空间
变体
操作

std::ctype<CharT>::~ctype

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

析构一个 std::ctype facet。此析构函数是受保护的和虚函数(由于 基类 析构函数是虚函数)。类型为 std::ctype 的对象,像大多数 facets 一样,只能在实现此 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
}