<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 695: ctype&lt;char&gt;::classic_table() not accessible</title>
<meta property="og:title" content="Issue 695: ctype&lt;char&gt;::classic_table() not accessible">
<meta property="og:description" content="C++ library issue. Status: CD1">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue695.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#CD1">CD1</a> status.</em></p>
<h3 id="695"><a href="lwg-defects.html#695">695</a>. ctype&lt;char&gt;::classic_table() not accessible</h3>
<p><b>Section:</b> 28.3.4.2.4 <a href="https://wg21.link/facet.ctype.special">[facet.ctype.special]</a> <b>Status:</b> <a href="lwg-active.html#CD1">CD1</a>
 <b>Submitter:</b> Martin Sebor <b>Opened:</b> 2007-06-22 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#CD1">CD1</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The   <code>ctype&lt;char&gt;::classic_table()</code>   static  member
function    returns    a    pointer    to   an    array    of    const
<code>ctype_base::mask</code>    objects    (enums)   that    contains
<code>ctype&lt;char&gt;::table_size</code>    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
<code>ctype&lt;char&gt;</code>  facet in the  classic "C"  locale (the
protected      <code>ctype&lt;char&gt;</code>      member     function
<code>table()</code>    then    returns     the    same    value    as
<code>classic_table()</code>).
</p>
<p>
However, while <code>ctype&lt;char&gt;::table_size</code> (the size of
the   table)    is   a   public    static   const   member    of   the
<code>ctype&lt;char&gt;</code>           specialization,           the
<code>classic_table()</code> 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.
</p>
<p>
The  same argument  can be  made for  the non-static  protected member
function <code>table()</code>.
</p>


<p id="res-695"><b>Proposed resolution:</b></p>
<p>
Make     the    <code>ctype&lt;char&gt;::classic_table()</code>    and
<code>ctype&lt;char&gt;::table()</code>  member  functions  public  by
moving their declarations into the public section of the definition of
specialization in 28.3.4.2.4 <a href="https://wg21.link/facet.ctype.special">[facet.ctype.special]</a> as shown below:
</p>
<blockquote>
<pre>
  static locale::id id;
  static const size_t table_size = IMPLEMENTATION_DEFINED;
<del>protected:</del>
  const mask* table() const throw();
  static const mask* classic_table() throw();
<ins>protected:</ins>

~ctype(); // virtual
virtual char do_toupper(char c) const;
</pre>
</blockquote>





</body>
</html>
