std::num_put::~num_put(3)
π
std::num_put::~num_put(3) π
okay bestie, welcome to the C++ Standard Libary manual β yes, that's the manual name, typo and all β and today's page is std::num_put::~num_put(3). It's giving tiny destructor lore, and we're gonna read it together. π«Ά
β¨ NAME β¨
std::num_put::~num_putβstd::num_put::~num_put
πΈ Synopsis πΈ
okay so first thing: it's defined in header <locale>. The signature drop is:
protected: ~num_put();
This bad boy destructs a std::num_put facet. The destructor is protected and virtual β and the virtual part is due to base class destructor being virtual. An object of type std::num_put, like most facets, can only be destroyed when the last std::locale object that implements this facet goes out of scope, or if a user-defined class is derived from std::num_put and implements a public destructor. periodt. π
π Example π
run this code, bestie:
// Run this code
#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) {}
// note: the implicit destructor is public
};
int main()
{
Destructible_num_put dc;
// std::num_put<wchar_t> c; // compile error: protected destructor
}
mwah π β this page is from http://cppreference.com, dated 2024.06.10, and it's serving std::num_put::~num_put(3) realness. π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms