std::ctype::~ctype(3)
πΈ std::ctype::~ctype(3) πΈ
okay bestie, this is the C++ Standard Libary manual page for std::ctype::~ctype β yes, the destructor episode, the goodbye era of a std::ctype facet. π
β¨ NAME β¨
std::ctype::~ctype - std::ctype::~ctype
π§ Synopsis π§
Defined in header <locale>:
protected: ~ctype();
It destructs a std::ctype facet. Literally its whole job. π«Ά
This destructor is protected and virtual (due to the base class destructor being virtual). An object of type std::ctype, 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::ctype and implements a public destructor. No cap. π
π Example π
// Run this code
#include <iostream>
#include <locale>
struct Destructible_ctype : public std::ctype<wchar_t>
{
Destructible_ctype(std::size_t refs = 0) : ctype(refs) {}
// note: the implicit destructor is public
};
int main()
{
Destructible_ctype dc;
// std::ctype<wchar_t> c; // compile error: protected destructor
}
Peep that commented-out line, bestie: std::ctype<wchar_t> c; is a compile error because the destructor is protected. The derived Destructible_ctype is giving βI made the destructor publicβ main character energy. πβ¨
mwah π β sourced from cppreference.com, version/date 2024.06.10, and thatβs the whole std::ctype::~ctype(3) page, periodt. π«Ά
π¦ 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