<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2230: &quot;see below&quot; for initializer-list constructors of unordered containers</title>
<meta property="og:title" content="Issue 2230: &quot;see below&quot; for initializer-list constructors of unordered containers">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2230.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="2230"><a href="lwg-defects.html#2230">2230</a>. &quot;<em>see below</em>&quot; for initializer-list constructors of unordered containers</h3>
<p><b>Section:</b> 23.5 <a href="https://wg21.link/unord">[unord]</a> <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2013-01-06 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>4
</p>
<p><b>View all other</b> <a href="lwg-index.html#unord">issues</a> in [unord].</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>
The <code>unordered_map</code> class definition in 23.5.3.1 <a href="https://wg21.link/unord.map.overview">[unord.map.overview]</a> declares an
initializer-list constructor that says "see below":
</p>

<blockquote><pre>
unordered_map(initializer_list&lt;value_type&gt;,
    size_type = <em>see below</em>,
    const hasher&amp; hf = hasher(),
    const key_equal&amp; eql = key_equal(),
    const allocator_type&amp; a = allocator_type());
</pre></blockquote>

<p>
But that constructor isn't defined below. The same problem exists for the other unordered associative containers.
</p>

<p><i>[2013-09 Chicago]</i></p>

<p>
STL: ordered are also missing declarations, but issue is forthcoming
<p/>
Walter: how does adding a signature address issue? &mdash; nevermind 
<p/>
Jayson: in his wording, isn't he just dropping the <code>size_type</code>?
<p/> 
Walter: partial fix is to introduce the name
<p/>
Stefanus: explanation of requiring name because of n buckets 
<p/>
STL: solution for his issue satisfies both ordered and unordered and is simplier than provided wording 
<p/>
STL: patches general table instead 
<p/>
STL: proposes adding extra rows instead of extra declarations 
<p/>
Stefanus: clarify <code>n</code> in the synopsis 
<p/>
Walter: general rule, name is optional in declaration 
<p/>
Stefanus: how to proceed 
<p/>
Walter: significant overlap with forthcoming issue, suggestion to defer
</p>

<p><i>[2014-02-20 Re-open Deferred issues as Priority 4]</i></p>


<p><i>[2014-03-27 Jonathan improves proposed wording]</i></p>


<p><i>[2014-05-20 STL and Jonathan communicate]</i></p>


<p>
STL: With <a href="lwg-defects.html#2322" title="Associative(initializer_list, stuff) constructors are underspecified (Status: C++14)">2322</a><sup><a href="https://cplusplus.github.io/LWG/issue2322" title="Latest snapshot">(i)</a></sup> resolved, is there anything left for this issue to fix?
<p/>
Jonathan: The synopsis still says "<em>see below</em>" and it's not immediately clear
that "<em>see below</em>" means "see the definition of a different constructor,
which defines the behaviour of this one due to a table defined much earlier".
</p>

<p><i>[2014-05-23 Library reflector vote]</i></p>

<p>
The issue has been identified as Tentatively Ready based on five votes in favour.
</p>



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

<ol>
<li><p>Edit 23.5.3.1 <a href="https://wg21.link/unord.map.overview">[unord.map.overview]</a>, class template <code>unordered_map</code> synopsis, as follows:</p>

<blockquote><pre>
[&hellip;]
unordered_map(initializer_list&lt;value_type&gt; <ins>il</ins>,
  size_type <ins>n</ins> = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
[&hellip;]
</pre></blockquote>
</li>

<li><p>Edit 23.5.3.2 <a href="https://wg21.link/unord.map.cnstr">[unord.map.cnstr]</a> as follows:</p>
<blockquote><pre>
template &lt;class InputIterator&gt;
unordered_map(InputIterator f, InputIterator l,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
<ins>unordered_map(initializer_list&lt;value_type&gt; il,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());</ins>
</pre><blockquote>
<p>
-3- <i>Effects</i>: Constructs an empty <code>unordered_map</code> using the specified hash function, key equality function,
and allocator, and using at least <code>n</code> buckets. If <code>n</code> is not provided, the number of buckets is
implementation-defined. Then inserts elements from the range <code>[f, l)</code> <ins>for the first form, or from the range 
<code>[il.begin(), il.end())</code> for the second form</ins>. <code>max_load_factor()</code> returns <code>1.0</code>.
</p>
</blockquote></blockquote>
</li>

<li><p>Edit 23.5.4.1 <a href="https://wg21.link/unord.multimap.overview">[unord.multimap.overview]</a>, class template <code>unordered_multimap</code> synopsis, as follows:</p>

<blockquote><pre>
[&hellip;]
unordered_multimap(initializer_list&lt;value_type&gt; <ins>il</ins>,
  size_type <ins>n</ins> = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
[&hellip;]
</pre></blockquote>
</li>

<li><p>Edit 23.5.4.2 <a href="https://wg21.link/unord.multimap.cnstr">[unord.multimap.cnstr]</a> as follows:</p>
<blockquote><pre>
template &lt;class InputIterator&gt;
unordered_multimap(InputIterator f, InputIterator l,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
<ins>unordered_multimap(initializer_list&lt;value_type&gt; il,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());</ins>
</pre><blockquote>
<p>
-3- <i>Effects</i>: Constructs an empty <code>unordered_multimap</code> using the specified hash function, key equality function,
and allocator, and using at least <code>n</code> buckets. If <code>n</code> is not provided, the number of buckets is
implementation-defined. Then inserts elements from the range <code>[f, l)</code> <ins>for the first form, or from the range 
<code>[il.begin(), il.end())</code> for the second form</ins>. <code>max_load_factor()</code> returns <code>1.0</code>.
</p>
</blockquote></blockquote>
</li>

<li><p>Edit 23.5.6.1 <a href="https://wg21.link/unord.set.overview">[unord.set.overview]</a>, class template <code>unordered_set</code> synopsis, as follows:</p>

<blockquote><pre>
[&hellip;]
unordered_set(initializer_list&lt;value_type&gt; <ins>il</ins>,
  size_type <ins>n</ins> = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
[&hellip;]
</pre></blockquote>
</li>

<li><p>Edit 23.5.6.2 <a href="https://wg21.link/unord.set.cnstr">[unord.set.cnstr]</a> as follows:</p>
<blockquote><pre>
template &lt;class InputIterator&gt;
unordered_set(InputIterator f, InputIterator l,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
<ins>unordered_set(initializer_list&lt;value_type&gt; il,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());</ins>
</pre><blockquote>
<p>
-3- <i>Effects</i>: Constructs an empty <code>unordered_set</code> using the specified hash function, key equality function,
and allocator, and using at least <code>n</code> buckets. If <code>n</code> is not provided, the number of buckets is
implementation-defined. Then inserts elements from the range <code>[f, l)</code> <ins>for the first form, or from the range 
<code>[il.begin(), il.end())</code> for the second form</ins>. <code>max_load_factor()</code> returns <code>1.0</code>.
</p>
</blockquote></blockquote>
</li>

<li><p>Edit 23.5.7.1 <a href="https://wg21.link/unord.multiset.overview">[unord.multiset.overview]</a>, class template <code>unordered_multiset</code> synopsis, as follows:</p>

<blockquote><pre>
[&hellip;]
unordered_multiset(initializer_list&lt;value_type&gt; <ins>il</ins>,
  size_type <ins>n</ins> = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
[&hellip;]
</pre></blockquote>
</li>

<li><p>Edit 23.5.7.2 <a href="https://wg21.link/unord.multiset.cnstr">[unord.multiset.cnstr]</a> as follows:</p>
<blockquote><pre>
template &lt;class InputIterator&gt;
unordered_multiset(InputIterator f, InputIterator l,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());
<ins>unordered_multiset(initializer_list&lt;value_type&gt; il,
  size_type n = <em>see below</em>,
  const hasher&amp; hf = hasher(),
  const key_equal&amp; eql = key_equal(),
  const allocator_type&amp; a = allocator_type());</ins>
</pre><blockquote>
<p>
-3- <i>Effects</i>: Constructs an empty <code>unordered_multiset</code> using the specified hash function, key equality function,
and allocator, and using at least <code>n</code> buckets. If <code>n</code> is not provided, the number of buckets is
implementation-defined. Then inserts elements from the range <code>[f, l)</code> <ins>for the first form, or from the range 
<code>[il.begin(), il.end())</code> for the second form</ins>. <code>max_load_factor()</code> returns <code>1.0</code>.
</p>
</blockquote></blockquote>
</li>
</ol>






</body>
</html>
