<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3212: tuple_element_t&lt;1, const span&lt;int, 42&gt;&gt; is const int</title>
<meta property="og:title" content="Issue 3212: tuple_element_t&lt;1, const span&lt;int, 42&gt;&gt; is const int">
<meta property="og:description" content="C++ library issue. Status: Resolved">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3212.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#Resolved">Resolved</a> status.</em></p>
<h3 id="3212"><a href="lwg-defects.html#3212">3212</a>. <code>tuple_element_t&lt;1, const span&lt;int, 42&gt;&gt;</code> is <code>const int</code></h3>
<p><b>Section:</b> 99 [span.tuple] <b>Status:</b> <a href="lwg-active.html#Resolved">Resolved</a>
 <b>Submitter:</b> Tim Song <b>Opened:</b> 2019-05-31 <b>Last modified:</b> 2020-09-06</p>
<p><b>Priority: </b>2
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
<p><b>Discussion:</b></p>
<p>
As currently specified, it uses the <i>cv</i>-qualified partial specialization, which incorrectly 
adds <i>cv</i>-qualification to the element type.
</p>

<strong>Previous resolution [SUPERSEDED]:</strong>
<blockquote class="note">
<p>This wording is relative to <a href="https://wg21.link/n4810">N4810</a>.</p>

<ol>
<li><p>Modify 23.7.2.1 <a href="https://wg21.link/span.syn">[span.syn]</a>, header <code>&lt;span&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
<i>// 99 [span.tuple], tuple interface</i>
template&lt;class T&gt; class tuple_size;
template&lt;size_t I, class T&gt; class tuple_element;
template&lt;class ElementType, size_t Extent&gt;
  struct tuple_size&lt;span&lt;ElementType, Extent&gt;&gt;;
template&lt;class ElementType&gt;
  struct tuple_size&lt;span&lt;ElementType, dynamic_extent&gt;&gt;; <i>// not defined</i>
template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, span&lt;ElementType, Extent&gt;&gt;;
<ins>template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, const span&lt;ElementType, Extent&gt;&gt;;
template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, volatile span&lt;ElementType, Extent&gt;&gt;;
template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, const volatile span&lt;ElementType, Extent&gt;&gt;;</ins>
[&hellip;]
</pre>
</blockquote>
</li>

<li><p>Modify 99 [span.tuple] before p1 as indicated:</p>

<blockquote class="note">
<p>
[<i>Drafting note:</i> The representation style for the newly added wording follows the new style
for <code>tuple_element&lt;I, span&lt;ElementType, Extent&gt;&gt;::type</code>, which 
  <a href="https://github.com/cplusplus/draft/pull/2868">had recently been changed editorially</a>.]
</p>
</blockquote>

<blockquote>
<pre>
template&lt;class ElementType, size_t Extent&gt;
  struct tuple_size&lt;span&lt;ElementType, Extent&gt;&gt;
    : integral_constant&lt;size_t, Extent&gt; { };

tuple_element&lt;I, span&lt;ElementType, Extent&gt;&gt;::type

<ins>template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, const span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };

template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, volatile span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };

template&lt;size_t I, class ElementType, size_t Extent>
  struct tuple_element&lt;I, const volatile span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };</ins>
</pre>
<blockquote>
<p>
-1- <i>Mandates:</i> <code>Extent != dynamic_extent &amp;&amp; I &lt; Extent</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>

</ol>
</blockquote>

<p><i>[2020-02-13, Prague]</i></p>

<p>
Wording needs to be adjusted, because we accepted <a href="https://wg21.link/p1831r1">P1831R1</a>.
</p>

<strong>Previous resolution [SUPERSEDED]:</strong>
<blockquote class="note">
<p>This wording is relative to <a href="https://wg21.link/n4849">N4849</a>.</p>

<ol>
<li><p>Modify 23.7.2.1 <a href="https://wg21.link/span.syn">[span.syn]</a>, header <code>&lt;span&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
<i>// 99 [span.tuple], tuple interface</i>
template&lt;class T&gt; class tuple_size;
template&lt;size_t I, class T&gt; class tuple_element;
template&lt;class ElementType, size_t Extent&gt;
  struct tuple_size&lt;span&lt;ElementType, Extent&gt;&gt;;
template&lt;class ElementType&gt;
  struct tuple_size&lt;span&lt;ElementType, dynamic_extent&gt;&gt;; <i>// not defined</i>
template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, span&lt;ElementType, Extent&gt;&gt;;
<ins>template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, const span&lt;ElementType, Extent&gt;&gt;;</ins>
[&hellip;]
</pre>
</blockquote>
</li>

<li><p>Modify 99 [span.tuple] before p1 as indicated:</p>

<blockquote>
<pre>
template&lt;class ElementType, size_t Extent&gt;
  struct tuple_size&lt;span&lt;ElementType, Extent&gt;&gt;
    : integral_constant&lt;size_t, Extent&gt; { };

template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };

<ins>template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, const span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };</ins>
</pre>
<blockquote>
<p>
-1- <i>Mandates:</i> <code>Extent != dynamic_extent &amp;&amp; I &lt; Extent</code> is <code>true</code>.
</p>
</blockquote>
</blockquote>
</li>

<li><p>Add the following wording to Annex D:</p>

<blockquote>
<p>
<ins><b>D.? Deprecated <code>span</code> tuple interface [depr.span.syn]</b></ins>
<p/>
<ins>1 The header <code>&lt;span&gt;</code> (23.7.2.1 <a href="https://wg21.link/span.syn">[span.syn]</a>) has the following additions:</ins>
</p>
<blockquote><pre>
<ins>
namespace std {
  template&lt;size_t I, class ElementType, size_t Extent&gt;
    struct tuple_element&lt;I, volatile span&lt;ElementType, Extent&gt;&gt;;
  template&lt;size_t I, class ElementType, size_t Extent&gt;
    struct tuple_element&lt;I, const volatile span&lt;ElementType, Extent&gt;&gt;;
}</ins>
</pre></blockquote>
<p>
<ins><b>D.1.? tuple interface [depr.span.tuple]</b></ins>
</p>
<blockquote><pre>
<ins>template&lt;size_t I, class ElementType, size_t Extent&gt;
  struct tuple_element&lt;I, volatile span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };

template&lt;size_t I, class ElementType, size_t Extent>
  struct tuple_element&lt;I, const volatile span&lt;ElementType, Extent&gt;&gt; {
    using type = ElementType;
  };</ins>
</pre></blockquote>
<p>
<ins>-?- <i>Mandates:</i> <code>Extent != dynamic_extent &amp;&amp; I &lt; Extent</code> is <code>true</code>.</ins>
</p>
</blockquote>
</li>

</ol>

</blockquote>

<p><i>[2020-02-14, Prague]</i></p>

<p>
Lengthy discussion about the intended design of <code>span</code>'s tuple interface. Has been send to LEWG, who
made several polls and concluded to remove the tuple interface for <code>span</code> for C++20.
<p/>
Will be resolved by <a href="https://wg21.link/p2116r0">P2116R0</a>.
</p>

<p><i>[2020-05-01; reflector discussions]</i></p>

<p>
Resolved by <a href="https://wg21.link/p2116r0">P2116R0</a> voted in in Prague.
</p>



<p id="res-3212"><b>Proposed resolution:</b></p>
<p>
Resolved by <a href="https://wg21.link/p2116r0">P2116R0</a>.
</p>




</body>
</html>
