<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2568: [fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraits</title>
<meta property="og:title" content="Issue 2568: [fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraits">
<meta property="og:description" content="C++ library issue. Status: TS">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2568.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#TS">TS</a> status.</em></p>
<h3 id="2568"><a href="lwg-defects.html#2568">2568</a>. [fund.ts.v2] Specification of logical operator traits uses <code>BaseCharacteristic</code>, which is defined only for 
<code>UnaryTypeTraits</code> and <code>BinaryTypeTraits</code></h3>
<p><b>Section:</b> 3.3.3 <a href="https://cplusplus.github.io/fundamentals-ts/v2.html#meta.logical">[fund.ts.v2::meta.logical]</a> <b>Status:</b> <a href="lwg-active.html#TS">TS</a>
 <b>Submitter:</b> Tim Song <b>Opened:</b> 2015-12-10 <b>Last modified:</b> 2020-09-06</p>
<p><b>Priority: </b>2
</p>
<p><b>View all other</b> <a href="lwg-index.html#fund.ts.v2::meta.logical">issues</a> in [fund.ts.v2::meta.logical].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#TS">TS</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: fund.ts.v2</b></p>
<p>
The specification of <code>conjunction</code> and <code>disjunction</code> uses the term <code>BaseCharacteristic</code>, which 
is problematic in several ways:
</p>
<ul>
<li><p>That term is defined in 21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a>, but only for <code>UnaryTypeTraits</code> and <code>BinaryTypeTraits</code>. 
<code>conjunction</code> and <code>disjunction</code> seem to be neither.</p></li>
<li><p>21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a> also requires the <code>BaseCharacteristic</code> for both <code>UnaryTypeTraits</code> and 
<code>BinaryTypeTraits</code> to be a specialization of <code>integral_constant</code>, which is inconsistent with the current design of 
<code>conjunction</code> and <code>disjunction</code>.</p></li>
<li><p>The requirement in 21.3.2 <a href="https://wg21.link/meta.rqmts">[meta.rqmts]</a> that "member names of the <code>BaseCharacteristic</code> shall not be hidden 
and shall be unambiguously available" seems impossible to meet in every case, since the arbitrary base class from which a 
specialization of <code>conjunction</code> or <code>disjunction</code> derives may contain members called <code>conjunction</code> or 
<code>disjunction</code> that will necessarily be hidden.</p></li>
</ul>

<p><i>[2016-08 Chicago]</i></p>

<p>
Ville provided wording for both <a href="lwg-defects.html#2567" title="Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits 
and BinaryTypeTraits (Status: C++17)">2567</a><sup><a href="https://cplusplus.github.io/LWG/issue2567" title="Latest snapshot">(i)</a></sup> and <a href="lwg-defects.html#2568" title="[fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for 
UnaryTypeTraits and BinaryTypeTraits (Status: TS)">2568</a><sup><a href="https://cplusplus.github.io/LWG/issue2568" title="Latest snapshot">(i)</a></sup>.
</p>

<p><i>[2016-08-07 Daniel provides wording borrowed from <a href="lwg-defects.html#2567" title="Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits 
and BinaryTypeTraits (Status: C++17)">2567</a><sup><a href="https://cplusplus.github.io/LWG/issue2567" title="Latest snapshot">(i)</a></sup>]</i></p>


<p><i>[2016-11-08, Issaquah]</i></p>

<p>Adopted during NB comment resolution</p>


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

<ol>
<li><p>In 3.3.3 <a href="https://cplusplus.github.io/fundamentals-ts/v2.html#meta.logical">[fund.ts.v2::meta.logical]</a> p3, edit as follows:</p>

<blockquote>
<pre>
template&lt;class... B&gt; struct conjunction : <i>see below</i> { };
</pre>
<blockquote>
<p>
-2- The class template <code>conjunction</code> forms the logical conjunction of its template type arguments. 
Every template type argument shall be usable as a base class and shall have a static data member <code>value</code> 
which is convertible to <code>bool</code>, is not hidden, and is unambiguously available in the type.
<p/>
-3- The <del>BaseCharacteristic of a</del> specialization <code>conjunction&lt;B1, &hellip;, BN&gt;</code>
<ins>has a public and unambiguous base that is either</ins> 
</p>
<ol style="list-style-type:none">
<li>&mdash; <ins>the first type <code>B<i>i</i></code> in the list <code>true_type, B1, ..., BN</code> for
which <code>bool(B<i>i</i>::value)</code> is <code>false</code>, or</ins></li>
<li>&mdash; <ins>if there is no such <code>B<i>i</i></code>, the last type in the list.</ins></li>
</ol>
<p>
<del>is the first type <code>B</code> in the list <code>true_type, B1, &hellip;, BN</code> for which 
<code>B::value == false</code>, or if <code>every B::value != false</code> the BaseCharacteristic is the last type 
in the list.</del> [<i>Note:</i> This means a specialization of conjunction does not necessarily <del>have a 
BaseCharacteristic of</del><ins>inherit from</ins> either <code>true_type</code> or <code>false_type</code>. 
&mdash; <i>end note</i>]
<p/>
<ins>-?- The member names of the base class, other than <code>conjunction</code> and <code>operator=</code>,
shall not be hidden and shall be unambiguously available in <code>conjunction</code>.</ins>
</p>
</blockquote>
</blockquote>
</li>

<li><p>In 3.3.3 <a href="https://cplusplus.github.io/fundamentals-ts/v2.html#meta.logical">[fund.ts.v2::meta.logical]</a> p6, edit as follows:</p>

<blockquote>
<pre>
template&lt;class... B&gt; struct disjunction : <i>see below</i> { };
</pre>
<blockquote>
<p>
-5- The class template <code>disjunction</code> forms the logical disjunction of its template type arguments. 
Every template type argument shall be usable as a base class and shall have a static data member <code>value</code> 
which is convertible to <code>bool</code>, is not hidden, and is unambiguously available in the type.
<p/>
-6- The <del>BaseCharacteristic of a</del> specialization <code>disjunction&lt;B1, &hellip;, BN&gt;</code>
<ins>has a public and unambiguous base that is either</ins> 
</p>
<ol style="list-style-type:none">
<li>&mdash; <ins>the first type <code>B<i>i</i></code> in the list <code>false_type, B1, ..., BN</code> for
which <code>bool(B<i>i</i>::value)</code> is <code>true</code>, or,</ins></li>
<li>&mdash; <ins>if there is no such <code>B<i>i</i></code>, the last type in the list.</ins></li>
</ol>
<p>
<del>is the first type <code>B</code> in the list <code>false_type, B1, &hellip;, BN</code> for which 
<code>B::value != false</code>, or if <code>every B::value == false</code> the BaseCharacteristic is the last type 
in the list.</del> [<i>Note:</i> This means a specialization of disjunction does not necessarily <del>have a 
BaseCharacteristic of</del><ins>inherit from</ins> either <code>true_type</code> or <code>false_type</code>. 
&mdash; <i>end note</i>]
<p/>
<ins>-?- The member names of the base class, other than <code>disjunction</code> and <code>operator=</code>,
shall not be hidden and shall be unambiguously available in <code>disjunction</code>.</ins>
</p>
</blockquote>
</blockquote>
</li>

<li><p>In 3.3.3 <a href="https://cplusplus.github.io/fundamentals-ts/v2.html#meta.logical">[fund.ts.v2::meta.logical]</a> p8, edit as follows:</p>

<blockquote>
<pre>
template&lt;class B&gt; struct negation : <del>integral_constant&lt;bool, !B::value&gt;</del><ins><i>see below</i></ins> { };
</pre>
<blockquote>
<p>
-8- The class template <code>negation</code> forms the logical negation of its template type argument. The type 
<code>negation&lt;B&gt;</code> is a UnaryTypeTrait with a BaseCharacteristic of <code>integral_constant&lt;bool, 
!<ins>bool(</ins>B::value<ins>)</ins>&gt;</code>.
</p>
</blockquote>
</blockquote>
</li>
</ol>





</body>
</html>
