<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2317: The type property queries should be UnaryTypeTraits returning size_t</title>
<meta property="og:title" content="Issue 2317: The type property queries should be UnaryTypeTraits returning size_t">
<meta property="og:description" content="C++ library issue. Status: C++14">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2317.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#C++14">C++14</a> status.</em></p>
<h3 id="2317"><a href="lwg-defects.html#2317">2317</a>. The type property queries should be <code>UnaryTypeTraits</code> returning <code>size_t</code></h3>
<p><b>Section:</b> 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a> <b>Status:</b> <a href="lwg-active.html#C++14">C++14</a>
 <b>Submitter:</b> Stephan T. Lavavej <b>Opened:</b> 2013-09-21 <b>Last modified:</b> 2017-07-05</p>
<p><b>Priority: </b>0
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++14">C++14</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The sibling sections 21.3.6 <a href="https://wg21.link/meta.unary">[meta.unary]</a>, 21.3.8 <a href="https://wg21.link/meta.rel">[meta.rel]</a>, and 21.3.9 <a href="https://wg21.link/meta.trans">[meta.trans]</a> respectively specify 
<code>UnaryTypeTraits</code>, <code>BinaryTypeTraits</code>, and <code>TransformationTraits</code>, as stated by each /2 paragraph.  However, 
21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a> is underspecified. <code>alignment_of</code>, <code>rank</code>, and <code>extent</code> are said to produce 
"Values", but the type of that Value is not specified, and the struct templates are not required to derive from <code>integral_constant</code>.  
Such derivation is more than stylistic &mdash; it allows the structs to be passed to functions taking <code>integral_constant</code>.
<p/>
<code>alignment_of</code> returns <code>alignof(T)</code> which is <code>size_t</code> (7.6.2.6 <a href="https://wg21.link/expr.alignof">[expr.alignof]</a>/2). <code>extent</code> returns 
an array bound, which is clearly <code>size_t</code>. <code>rank</code> returns "the number of dimensions" of an array, so any type could 
be chosen, with <code>size_t</code> being a reasonable choice. (Another choice would be <code>unsigned int</code>, to match <code>extent</code>'s 
template parameter <code>I</code>.)
</p>

<p><i>[Issaquah 2014-02-11: Move to Immediate]</i></p>




<p id="res-2317"><b>Proposed resolution:</b></p>
<p>This wording is relative to N3691.</p>

<ol>
<li><p>Following 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a>/1 add a new paragraph as indicated:</p>

<blockquote><p>
<ins>Each of these templates shall be a <code>UnaryTypeTrait</code> (21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a>) with a <code>BaseCharacteristic</code> of 
<code>integral_constant&lt;size_t, Value&gt;</code>.</ins>
</p>
</blockquote>
</li>

</ol>





</body>
</html>
