Section: 28.3.4.2.4 [facet.ctype.special] Status: CD1 Submitter: Martin Sebor Opened: 2007-06-22 Last modified: 2016-01-28
Priority: Not Prioritized
View all issues with CD1 status.
Discussion:
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()
.
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 28.3.4.2.4 [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;