public member class
<locale>

std::locale::facet

class facet;
Locale facet
Base class for locale facets.

A facet is a class describing a locale feature set associated to a specific cultural aspect.

Custom facets may be created by inheriting this member class (either directly or indirectly), and by containing a static member of type locale::id and a set of features as const-qualified member functions.

It is defined as:
1
2
3
4
5
6
7
8
class locale::facet {
protected:
  explicit facet (size_t refs = 0);
  virtual ~facet();
private:
  facet (const facet&);           // not defined
  void operator= (const facet&);  // not defined
}

The copy constructor and copy assignment are private, preventing the copy of facet objects.
It is defined as:
1
2
3
4
5
6
7
class locale::facet {
protected:
  explicit facet (size_t refs = 0);
  virtual ~facet();
  facet (const facet&) = delete;
  void operator= (const facet&) = delete;
}

The copy constructor and copy assignment are deleted, preventing the copy of facet objects.

This base class basically implements a protected constructor that takes one parameter. This parameter, refs, shall be 0 (zero) if the facet has to be automatically destroyed when the last locale object containing that facet is destroyed, and 1 (one) if it does not have to.

Derived classes defining specific facets shall also have a constructor taking a refs parameter, which is passed to their base class.

A virtual destructor ensures proper destruction of derived objects.