Namespaces
Variants

std::num_put<CharT,OutputIt>:: ~num_put

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

析构 std:: num_put facet。此析构函数为受保护且虚函数(因其 基类 析构函数为虚函数)。与大多数 facet 类似, std:: num_put 类型的对象仅当最后一个实现该 facet 的 std::locale 对象离开作用域时,或用户自定义类继承自 std:: num_put 并实现了公共析构函数时才能被销毁。

示例

#include <iostream>
#include <locale>
struct Destructible_num_put : public std::num_put<wchar_t>
{
    Destructible_num_put(std::size_t refs = 0) : num_put(refs) {}
    // 注意:隐式析构函数是公开的
};
int main()
{
    Destructible_num_put dc;
    // std::num_put<wchar_t> c; // 编译错误:受保护的析构函数
}