std::messages::~messages(3)
okay bestie, this manual page is std::messages::~messages(3), and the manual name is C++ Standard Libary (yes, exactly like that on the page, no cap π). It's giving destructor lore, and we're gonna get through it together. π
π NAME π
std::messages::~messages β literally std::messages::~messages, the destructor page, periodt. β¨
πΈ Synopsis πΈ
Defined in header <locale> π«Ά
protected: ~messages();
So here's the tea: it destructs a std::messages facet. This destructor is protected and virtual (due to base class destructor being virtual, iykyk π
).
An object of type std::messages, 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::messages and implements a public destructor. That's the whole rule, no cap. π¦
π§ Example π§
Run this code, bestie:
#include <iostream>
#include <locale>
struct Destructible_messages : public std::messages<wchar_t>
{
Destructible_messages(std::size_t refs = 0) : messages(refs) {}
// note: the implicit destructor is public
};
int main()
{
Destructible_messages dc;
// std::messages<wchar_t> c; // compile error: protected destructor
}
Not the comment literally saying // compile error: protected destructor π β respect the protected destructor, okay? π
okay that's the whole page! Source/version/date sign-off: http://cppreference.com, 2024.06.10, and the page is std::messages::~messages(3) β mwah, bye bestie πβ¨π
π¦ 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