CppDS.com

C++ 98 11 14 17 20 手册

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

来自cppreference.com
< cpp‎ | locale‎ | num get

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

析构 std::num_get 平面。此析构函数为受保护且为虚(由于基类析构函数为虚)。 std::num_get 类型对象,同大多数平面,只能在最后一个实装此平面的 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;  // 编译错误:受保护析构函数
}


关闭