std::time_put::~time_put(3)
π¦ std::time_put::~time_put(3) β C++ Standard Libary π¦
okay bestie, this is the C++ Standard Libary manual page for std::time_put::~time_put β the destructor of the std::time_put facet. It's giving tiny page, very specific job, and we're gonna read it together. π
β¨ NAME β¨
std::time_put::~time_put β std::time_put::~time_put
πΈ Synopsis πΈ
Defined in header <locale>:
protected: ~time_put();
So yes, it destructs a std::time_put facet. This destructor is protected and virtual β the virtual part is because the base class destructor is virtual. No cap. π«Ά
An object of type std::time_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::time_put and implements a public destructor. That's the whole vibe check. π
π§ Example π§
The original says // Run this code, and here it is, bestie β exactly as given:
#include <iostream>
#include <locale>
struct Destructible_time_put : public std::time_put<wchar_t>
{
Destructible_time_put(std::size_t refs = 0) : time_put(refs) {}
// note: the implicit destructor is public
};
int main()
{
Destructible_time_put dc;
// std::time_put<wchar_t> c; // compile error: protected destructor
}
lowkey iconic that the commented-out line is the whole protected-destructor lesson π
made with π by http://cppreference.com β version/date 2024.06.10 β bye bestie, go destroy some facets responsibly πβ¨
π¦ 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