std::numpunct::~numpunct(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

std::numpunct::~numpunct β€” that’s the name, bestie: std::numpunct::~numpunct. This page comes from the C++ Standard Libary manual (yes, β€œLibary” exactly like the header says β€” keeping it πŸ’―).


πŸ¦‹ Synopsis πŸ¦‹

Defined in header <locale>:

protected: ~numpunct();

Okay so this destructor destructs a std::numpunct facet. It’s protected and virtual β€” virtual because the base class destructor is virtual, iykyk. An object of type std::numpunct, 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::numpunct and implements a public destructor. That’s the whole vibe, no cap πŸ’….


πŸŽ€ Example πŸŽ€

// Run this code

#include <iostream>
#include <locale>

struct Destructible_numpunct : public std::numpunct<wchar_t>
{
    Destructible_numpunct(std::size_t refs = 0) : numpunct(refs) {}
    // note: the implicit destructor is public
};

int main()
{
    Destructible_numpunct dc;
    // std::numpunct<wchar_t> c; // compile error: protected destructor
}

Source/version and date, for the record: http://cppreference.com Β· 2024.06.10 Β· std::numpunct::~numpunct(3) β€” bye bestie, go forth and destruct responsibly πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from