<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2119: Missing hash specializations for extended integer types</title>
<meta property="og:title" content="Issue 2119: Missing hash specializations for extended integer types">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2119.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++17">C++17</a> status.</em></p>
<h3 id="2119"><a href="lwg-defects.html#2119">2119</a>. Missing <code>hash</code> specializations for extended integer types</h3>
<p><b>Section:</b> 22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a> <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Daniel Kr&uuml;gler <b>Opened:</b> 2011-12-16 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>3
</p>
<p><b>View all other</b> <a href="lwg-index.html#unord.hash">issues</a> in [unord.hash].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
<p><b>Discussion:</b></p>

<p>
According to the header <code>&lt;functional&gt;</code> synopsis 22.10 <a href="https://wg21.link/function.objects">[function.objects]</a> 
and to the explicit description in 22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a> class template 
<code>hash</code> specializations shall be provided for all arithmetic types that are 
not extended integer types. This is not explicitly mentioned, but neither the list 
nor any normative wording does include them, so it follows by implication.
<p/>
What are the reasons that extended integer types are excluded? E.g. for 
<code>numeric_limits</code> corresponding specializations are required. I would 
expect that an <code>unordered_map</code> with key type <code>std::uintmax_t</code> would 
just work, but that depends now on whether this type is an extended integer type 
or not.
<p/>
This issue is <em>not</em> asking for also providing specializations for the
<i>cv</i>-qualified arithmetic types. While this is surely a nice-to-have feature,
I consider that restriction as a more secondary problem in practice.
<p/>
The proposed resolution also fixes a problem mentioned in <a href="lwg-defects.html#2109" title="Incorrect requirements for hash specializations (Status: C++14)">2109</a><sup><a href="https://cplusplus.github.io/LWG/issue2109" title="Latest snapshot">(i)</a></sup> in regard
to confusing requirements on user-defined types and those on implementations.
</p>

<p><i>[2012, Kona]</i></p>

<p>
Move to Open.
</p>
<p>
Agreed that it's a real issue and that the proposed wording fixes it. However, the wording
change is not minimal and isn't consistent with the way we fixed hash wording elsewhere.
</p>
<p>Alisdair will provide updated wording.
</p>

<p><i>[2014-05-06 Geoffrey Romer suggests alternative wording]</i></p>


<p>
<strong>Previous resolution from Daniel [SUPERSEDED]:</strong>
</p>
<blockquote class="note">
<p>This wording is relative to the FDIS.</p>

<p>Change 22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a> p2 as indicated:</p>

<blockquote><pre>
template &lt;&gt; struct hash&lt;bool&gt;;
template &lt;&gt; struct hash&lt;char&gt;;
[&hellip;]
template &lt;&gt; struct hash&lt;long double&gt;;
template &lt;class T&gt; struct hash&lt;T*&gt;;
</pre><blockquote>
<p>
-2- <del><i>Requires</i>: the template specializations shall meet the requirements 
of class template <code>hash</code> (22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a>)</del><ins>The header 
<code>&lt;functional&gt;</code> provides definitions for specializations of the 
<code>hash</code> class template for each <i>cv</i>-unqualified arithmetic type. This 
header also provides a definition for a partial specialization of the <code>hash</code> 
class template for any pointer type. The requirements for the members of these 
specializations are given in sub-clause 22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a></ins>.
</p>
</blockquote></blockquote>
</blockquote>

<p><i>[2015-05, Lenexa]</i></p>

<p>
STL: the new PR is very simple and could resolve that nicely<br/>
MC: the older PR is rather longish
</p>
<ul>
<li><p>anybody have any objections to this approach?</p></li>
<li><p>what people want to have as a status?</p></li>
</ul>
<p>
STL: I want to have Ready<br/>
MC: move to ready: in favor: 13, opposed: 0, abstain: 4 
</p>


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

<p>Change 22.10.19 <a href="https://wg21.link/unord.hash">[unord.hash]</a> p1 as indicated:</p>

<blockquote><p>
The unordered associative containers defined in 23.5 use specializations of the class template <code>hash</code> as the
default hash function. For all object types <code>Key</code> for which there exists a specialization <code>hash&lt;Key&gt;</code>, 
and for all <ins>integral and</ins> enumeration types (7.2) <code>Key</code>, the instantiation <code>hash&lt;Key&gt;</code> shall: [&hellip;]
</p></blockquote>






</body>
</html>
