std::moneyp...~moneypunct(3)
π std::moneyp...~moneypunct(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::moneypunct::~moneypunct β yes, the destructor. Itβs giving tiny cleanup era, and honestly the vibes are immaculate. π
β¨ NAME β¨
std::moneypunct::~moneypunctβstd::moneypunct::~moneypunct(yes, it literally says the name twice, and thatβs iconic)
πΈ Synopsis πΈ
Defined in header <locale> β thatβs home base, bestie.
protected: ~moneypunct();
This destructor literally destructs a std::moneypunct facet. Itβs protected and virtual (because the base class destructor is virtual, so it inherits that energy).
An object of type std::moneypunct, 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::moneypunct and implements a public destructor. Periodt. π
π Example π
// Run this code
#include <iostream>
#include <locale>
struct Destructible_moneypunct : public std::moneypunct<wchar_t>
{
Destructible_moneypunct(std::size_t refs = 0) : moneypunct(refs) {}
// note: the implicit destructor is public
};
int main()
{
Destructible_moneypunct dc;
// std::moneypunct<wchar_t> c; // compile error: protected destructor
}
The way this example ate: Destructible_moneypunct derives from std::moneypunct<wchar_t>, gives itself a constructor with std::size_t refs = 0 forwarding to moneypunct(refs), and leaves the implicit destructor public. Meanwhile the commented-out std::moneypunct<wchar_t> c; is a compile error because the destructor is protected. No cap. π¦
okay thatβs the page, bestie π source is http://cppreference.com, version/date is 2024.06.10, and we made it through std::moneyp...~moneypunct(3) together. slay. π
π¦ 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