<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3354: has_strong_structural_equality has a meaningless definition</title>
<meta property="og:title" content="Issue 3354: has_strong_structural_equality has a meaningless definition">
<meta property="og:description" content="C++ library issue. Status: C++20">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3354.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++20">C++20</a> status.</em></p>
<h3 id="3354"><a href="lwg-defects.html#3354">3354</a>. <code>has_strong_structural_equality</code> has a meaningless definition</h3>
<p><b>Section:</b> 21.3.6.4 <a href="https://wg21.link/meta.unary.prop">[meta.unary.prop]</a>, 17.3.2 <a href="https://wg21.link/version.syn">[version.syn]</a> <b>Status:</b> <a href="lwg-active.html#C++20">C++20</a>
 <b>Submitter:</b> Daniel Kr&uuml;gler <b>Opened:</b> 2019-12-08 <b>Last modified:</b> 2021-02-25</p>
<p><b>Priority: </b>1
</p>
<p><b>View other</b> <a href="lwg-index-open.html#meta.unary.prop">active issues</a> in [meta.unary.prop].</p>
<p><b>View all other</b> <a href="lwg-index.html#meta.unary.prop">issues</a> in [meta.unary.prop].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++20">C++20</a> status.</p>
<p><b>Discussion:</b></p>
<p>
After the Belfast 2019 meeting with the acceptance of <a href="https://wg21.link/p1907r1">P1907R1</a>
the core language term "strong structural equality" has been removed and instead a more general 
definition of a "structural type" has been introduced that is suitable to be used as non-type template
parameter. These changes have caused the current definition of the <code>has_strong_structural_equality</code>
type trait (which had originally been introduced by <a href="https://wg21.link/p1614r2">P1614R2</a>
during the Cologne 2019 meeting) to become meaningless since it is currently defined as follows:
</p>
<blockquote>
<p>
The type <code>T</code> has strong structural equality (11.10.1 <a href="https://wg21.link/class.compare.default">[class.compare.default]</a>).
</p>
</blockquote>
<p>
Besides the now undefined term "strong structural equality", the reference to 11.10.1 <a href="https://wg21.link/class.compare.default">[class.compare.default]</a>
doesn't make sense anymore, assuming that the trait definition is supposed to refer now to a type that 
can be used as non-type template parameter.
<p/>
During library reflector discussions several informal naming suggestions has been mentioned, such as
<code>is_structural[_type]</code>, <code>can_be_nttp</code>, <code>is_nontype_template_parameter_type</code>.
<p/>
Albeit <code>is_structural_type</code> would come very near to the current core terminology, core experts 
have argued that the term "structural type" should be considered as a "core-internal" term that may
easily be replaced post-C++20.
<p/>
In addition to that definition and naming question of that type trait it should be discussed whether
there should exist a specific feature macro for just this type trait, similar to the reason why we 
introduced the <code>__cpp_lib_has_unique_object_representations</code> test macro for the
<code>has_unique_object_representations</code> type trait while voting in 
<a href="https://wg21.link/p0258r2">P0258R2</a>. The submitter of this issue believes that such a feature 
macro should be added and given that its final definition should be related to the date of the
acceptance of this issue (and should <em>not</em> be related to any historically accepted papers such as 
<a href="https://wg21.link/p1614r2">P1614R2</a>).
</p>

<p><i>[2020-01 Priority set to 1 and questions to LEWG after review on the reflector.]</i></p>


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

<ol>
<li><p>Modify 17.3.2 <a href="https://wg21.link/version.syn">[version.syn]</a>, header <code>&lt;version&gt;</code> synopsis, as indicated (The
symbolic <code>??????L</code> represents the date to be defined by the project editor):</p>

<blockquote>
<pre>
[&hellip;]
#define __cpp_lib_is_swappable               201603L <i>// also in &lt;type_traits&gt;</i>
<ins>#define __cpp_lib_is_template_parameter_type ??????L <i>// also in &lt;type_traits&gt;</i></ins>
#define __cpp_lib_jthread                    201911L <i>// also in &lt;stop_token&gt;, &lt;thread&gt;</i>
[&hellip;]
</pre>
</blockquote>
</li>

<li><p>Modify 21.3.3 <a href="https://wg21.link/meta.type.synop">[meta.type.synop]</a>, header <code>&lt;type_traits&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
template&lt;class T&gt; struct has_unique_object_representations;

template&lt;class T&gt; struct <del>has_strong_structural_equality</del><ins>is_template_parameter_type</ins>;

<i>// 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a>, type property queries</i>
[&hellip;]
template&lt;class T&gt;
  inline constexpr bool has_unique_object_representations_v
    = has_unique_object_representations&lt;T&gt;::value;

template&lt;class T&gt;
  inline constexpr bool <del>has_strong_structural_equality_v</del><ins>is_template_parameter_type_v</ins>
    = <del>has_strong_structural_equality</del><ins>is_template_parameter_type</ins>&lt;T&gt;::value;
    
<i>// 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a>, type property queries</i>
[&hellip;]
</pre>
</blockquote>
</li>

<li><p>Modify 21.3.3 <a href="https://wg21.link/meta.type.synop">[meta.type.synop]</a>, Table 47 ([tab:meta.unary.prop]) &mdash; 
"Type property predicates" &mdash; as indicated:</p>

<blockquote>
<table border="1">
<caption>Table 47: Type property predicates [tab:meta.unary.prop]</caption>
<tr>
<th align="center">Template</th>
<th align="center">Condition</th>
<th align="center">Preconditions</th>
</tr>

<tr>
<td colspan="3" align="center">
<code>&hellip;</code>
</td>
</tr>

<tr>
<td>
<code>template&lt;class T&gt;<br/>
struct<br/>
<del>has_strong_structural_equality</del><ins>is_template_parameter_type</ins>;</code>
</td>

<td>
The type <code>T</code> <del>has strong<br/>
structural<br/>
equality (11.10.1 <a href="https://wg21.link/class.compare.default">[class.compare.default]</a>)</del><br/>
<ins>can be used as non-type<br/>
<i>template-parameter</i> (13.2 <a href="https://wg21.link/temp.param">[temp.param]</a>)</ins>.
</td>

<td>
<del><code>T</code> shall be a complete type,<br/>
<i>cv</i> <code>void</code>, or an array of<br/>
unknown bound.</del><br/>
<ins>If <code>T</code> is a class type, <code>T</code> shall<br/>
be a complete type.</ins>
</td>
</tr>

<tr>
<td colspan="3" align="center">
<code>&hellip;</code>
</td>
</tr>

</table>
</blockquote>
</li>

</ol>
</blockquote>

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

<p>
LEWG looked at this and suggested to remove the existing trait <code>has_strong_structural_equality</code>
for now until someone demonstrates which usecases exist that would justify its existence.
</p>

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

<p>
Set to Immediate.
</p>


<p id="res-3354"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4849">N4849</a>.</p>

<ol>
<li><p>Modify 21.3.3 <a href="https://wg21.link/meta.type.synop">[meta.type.synop]</a>, header <code>&lt;type_traits&gt;</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
template&lt;class T&gt; struct has_unique_object_representations;

<del>template&lt;class T&gt; struct has_strong_structural_equality;</del>

<i>// 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a>, type property queries</i>
[&hellip;]
template&lt;class T&gt;
  inline constexpr bool has_unique_object_representations_v
    = has_unique_object_representations&lt;T&gt;::value;

<del>template&lt;class T&gt;
  inline constexpr bool has_strong_structural_equality_v
    = has_strong_structural_equality&lt;T&gt;::value;</del>
    
<i>// 21.3.7 <a href="https://wg21.link/meta.unary.prop.query">[meta.unary.prop.query]</a>, type property queries</i>
[&hellip;]
</pre>
</blockquote>
</li>

<li><p>Modify 21.3.3 <a href="https://wg21.link/meta.type.synop">[meta.type.synop]</a>, Table 47 ([tab:meta.unary.prop]) &mdash; 
"Type property predicates" &mdash; as indicated:</p>

<blockquote>
<table border="1">
<caption>Table 47: Type property predicates [tab:meta.unary.prop]</caption>
<tr>
<th align="center">Template</th>
<th align="center">Condition</th>
<th align="center">Preconditions</th>
</tr>

<tr>
<td colspan="3" align="center">
<code>&hellip;</code>
</td>
</tr>

<tr>
<td>
<del><code>template&lt;class T&gt;<br/>
struct<br/>
has_strong_structural_equality;</code></del>
</td>

<td>
<del>The type <code>T</code> has strong<br/>
structural<br/>
equality (11.10.1 <a href="https://wg21.link/class.compare.default">[class.compare.default]</a>).</del>
</td>

<td>
<del><code>T</code> shall be a complete type,<br/>
<i>cv</i> <code>void</code>, or an array of<br/>
unknown bound.</del>
</td>
</tr>
</table>
</blockquote>
</li>

</ol>




</body>
</html>
