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

< cpp‎ | locale‎ | money get

定义于头文件 <locale>
protected: ~money_get();

析构 std::money_get 平面。此析构函数为受保护且为虚(由于基类析构函数为虚)。 std::money_get 类型对象,同大多数平面,只能在最后一个实装此平面的 std::locale 离开作用域时,或若用户定义导出自 std::money_get 并实现公开构造函数,才会被销毁。

示例

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