std::numpunct<CharT>::~numpunct
来自 cppreference.cn
在头文件 <locale> 中定义 |
||
protected: ~numpunct(); |
||
析构一个 std::numpunct facet。此析构函数是受保护的和虚函数(由于 基类 析构函数是虚函数)。类型为 std::numpunct 的对象,像大多数 facets 一样,只有在最后一个实现此 facet 的 std::locale 对象超出作用域时,或者当用户定义的类派生自 std::numpunct 并实现公共析构函数时,才能被销毁。
[编辑] 示例
运行此代码
#include <iostream> #include <locale> struct Destructible_numpunct : public std::numpunct<wchar_t> { Destructible_numpunct(std::size_t refs = 0) : numpunct(refs) {} // note: the implicit destructor is public }; int main() { Destructible_numpunct dc; // std::numpunct<wchar_t> c; // compile error: protected destructor }