命名空间
变体
操作

std::num_get<CharT,InputIt>::~num_get

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

析构一个 std::num_get facet。此析构函数为受保护且为虚函数(因为基类析构函数为虚函数)。类型为 std::num_get 的对象,如同大多数 facet 一样,仅能在最后一个实现此 facet 的 std::locale 对象超出作用域时,或者当用户定义的类派生自 std::num_get 并实现了一个公共析构函数时,才会被销毁。

[编辑] 示例

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