Namespaces
Variants

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

From cppreference.net
定义于头文件 <locale>
protected : ~num_get ( ) ;

析构 std:: num_get facet。此析构函数受保护且为虚函数(因 基类 析构函数为虚函数)。与大多数facet类似, std:: num_get 类型的对象仅当最后一个实现该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) {}
    // 注意:隐式析构函数是公开的
};
int main()
{
    Destructible_num_get dc;
    // std::num_get<wchar_t> c; // 编译错误:受保护的析构函数
}