Namespaces
Variants

std::moneypunct<CharT,International>:: ~moneypunct

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

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

示例

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