Title
ctype<char>::classic_table() not accessible
Status
cd1
Section
[facet.ctype.special]
Submitter
Martin Sebor

Created on 2007-06-22.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Make the ctype<char>::classic_table() and ctype<char>::table() member functions public by moving their declarations into the public section of the definition of specialization in [facet.ctype.special] as shown below:

  static locale::id id;
  static const size_t table_size = IMPLEMENTATION_DEFINED;
protected:
  const mask* table() const throw();
  static const mask* classic_table() throw();
protected:

~ctype(); // virtual
virtual char do_toupper(char c) const;
Date: 2007-06-22.00:00:00

The ctype<char>::classic_table() static member function returns a pointer to an array of const ctype_base::mask objects (enums) that contains ctype<char>::table_size elements. The table describes the properties of the character set in the "C" locale (i.e., whether a character at an index given by its value is alpha, digit, punct, etc.), and is typically used to initialize the ctype<char> facet in the classic "C" locale (the protected ctype<char> member function table() then returns the same value as classic_table()).

However, while ctype<char>::table_size (the size of the table) is a public static const member of the ctype<char> specialization, the classic_table() static member function is protected. That makes getting at the classic data less than convenient (i.e., one has to create a whole derived class just to get at the masks array). It makes little sense to expose the size of the table in the public interface while making the table itself protected, especially when the table is a constant object.

The same argument can be made for the non-static protected member function table().

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3461
2007-06-22 00:00:00admincreate