locale::facet


public member class
class facet;

Locale facet

Base class for locale facets.

A facet is a class describing a locale feature set.

In order for a facet class to be used as template parameter for use_facet and has_facet, it shall be publicly derived -direct or indirectly- from this member class, and shall also have a member called id of type locale::id defined.

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
}


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 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 also have a constructor taking a refs parameter, which is passed to their base class.

The copy constructor and copy assignment are private, disabling the possibility to copy facet objects.