2229. Standard code conversion facets underspecified

Section: D.17 [depr.locale.stdcvt] Status: C++14 Submitter: Beman Dawes Opened: 2012-12-30 Last modified: 2017-05-13

Priority: Not Prioritized

View all other issues in [depr.locale.stdcvt].

View all issues with C++14 status.

Discussion:

The only specification for the non-inherited members of classes codecvt_utf8, codecvt_utf16, and codecvt_utf8_utf16 is a comment line in the synopsis that says // unspecified. There is no further indication of functionality, so a user does not know if one of these classes can be constructed or destroyed.

The proposed resolution adds a constructor that mimics the class codecvt constructor, and also adds a destructor. Following the practice of class codecvt, the semantics are not specified.

The only existing implementation I could find was libc++, and it does supply the proposed constructor and destructor for each of the three classes.

[2013-03-15 Issues Teleconference]

Moved to Review.

There was concern about the unspecified semantics - but that matches what is done in codecvt.

Jonathan: Should these constructor/destructors be public? Proposed wording is private. Base class constructor is public.

Howard noted that other facets do not have specified constructors.

Alisdair noted that this whole section was new in C++11.

Howard suggested looking at section 25.3.1.1.2 [locale.facet]p2/p3 for more info.

[2013-04-18, Bristol]

Proposed resolution:

In [locale.stdcvt] paragraph 2, Header codecvt synopsis:

template<class Elem, unsigned long Maxcode = 0x10ffff,
  codecvt_mode Mode = (codecvt_mode)0>
class codecvt_utf8
  : public codecvt<Elem, char, mbstate_t> {
  // unspecified
public:
  explicit codecvt_utf8(size_t refs = 0);
  ~codecvt_utf8();
  };

template<class Elem, unsigned long Maxcode = 0x10ffff,
  codecvt_mode Mode = (codecvt_mode)0>
class codecvt_utf16
  : public codecvt<Elem, char, mbstate_t> {
  // unspecified
public:
  explicit codecvt_utf16(size_t refs = 0);
  ~codecvt_utf16();
  };

template<class Elem, unsigned long Maxcode = 0x10ffff,
  codecvt_mode Mode = (codecvt_mode)0>
class codecvt_utf8_utf16
  : public codecvt<Elem, char, mbstate_t> {
  // unspecified
public:
  explicit codecvt_utf8_utf16(size_t refs = 0);
  ~codecvt_utf8_utf16();
  };