std::ctype<CharT>::~ctype
来自 cppreference.cn
定义于头文件 <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 }