CppDS.com

C++ 98 11 14 17 20 手册

std::ctype<CharT>::~ctype

来自cppreference.com
< cpp‎ | locale‎ | ctype

 
 
 
 
定义于头文件 <locale>
protected: ~ctype();

析构 std::ctype 平面。此析构函数为受保护且为虚(由于基类析构函数为虚)。 std::ctype 类型对象,同大多数平面,只能在最后一个实装此平面的 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) {}
    // 注意:隐式析构函数为公开
};
int main()
{
    Destructible_ctype dc;
    // std::ctype<wchar_t> c;  // 编译错误:受保护析构函数
}


关闭