<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2052: Mixup between mapped_type and value_type for associative containers</title>
<meta property="og:title" content="Issue 2052: Mixup between mapped_type and value_type for associative containers">
<meta property="og:description" content="C++ library issue. Status: Resolved">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2052.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="2052"><a href="lwg-defects.html#2052">2052</a>. Mixup between <code>mapped_type</code> and <code>value_type</code> for associative containers</h3>
<p><b>Section:</b> 23.2.7 <a href="https://wg21.link/associative.reqmts">[associative.reqmts]</a> <b>Status:</b> <a href="lwg-active.html#Resolved">Resolved</a>
 <b>Submitter:</b> Marc Glisse <b>Opened:</b> 2011-05-04 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>2
</p>
<p><b>View other</b> <a href="lwg-index-open.html#associative.reqmts">active issues</a> in [associative.reqmts].</p>
<p><b>View all other</b> <a href="lwg-index.html#associative.reqmts">issues</a> in [associative.reqmts].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#Resolved">Resolved</a> status.</p>
<p><b>Discussion:</b></p>
<p>
(this is basically reopening the first part of issue <a href="lwg-closed.html#2006" title="emplace broken for associative containers (Status: NAD)">2006</a><sup><a href="https://cplusplus.github.io/LWG/issue2006" title="Latest snapshot">(i)</a></sup>, as discussed in the thread 
starting at c++std-lib-30698 )
<p/>
Section 23.2.7 <a href="https://wg21.link/associative.reqmts">[associative.reqmts]</a>
<p/>
In Table 102, several uses of <code>T</code> (which means <code>mapped_type</code> here) should
be <code>value_type</code> instead. This is almost editorial. For instance:
</p>
<blockquote><pre>
a_uniq.emplace(args)
</pre><p>
<i>Requires</i>: <code>T</code> shall be <code>EmplaceConstructible</code> into <code>X</code> from args.
<p/>
<i>Effects</i>: Inserts a <code>T</code> object <code>t</code> constructed with
<code>std::forward&lt;Args&gt;(args)...</code> if and only if there is no element in the
container with key equivalent to the key of <code>t</code>. The <code>bool</code> component of
the returned pair is true if and only if the insertion takes place, and the iterator component 
of the pair points to the element with key equivalent to the key of <code>t</code>.
</p></blockquote>

<p><i>[
2011 Bloomington
]</i></p>


<p>
Not even an exhaustive list of problem locations. No reason to doubt issue.
</p>
<p>
Pablo agrees to provide wording.
</p>

<p><i>[
2011-09-04 Pablo Halpern provides improved wording
]</i></p>


<p><i>[2014-02-15 post-Issaquah session : move to Resolved]</i></p>

<p>
AJM to replace this note with a 'Resolved By...' after tracking down the exact sequence of events, but clearly resolved in C++14 DIS.
</p>



<p id="res-2052"><b>Proposed resolution:</b></p>
<p>
In both section 23.2.7 <a href="https://wg21.link/associative.reqmts">[associative.reqmts]</a> Table 102 and 23.2.8 <a href="https://wg21.link/unord.req">[unord.req]</a>, Table 103, make the following text replacements:
</p>

<table border="1">
<tr> <td>Original text, in FDIS</td> <td>Replacement text</td> </tr>

<tr> 
<td><code>T</code> is CopyInsertable into <code>X</code> and <code>CopyAssignable</code>.</td>
<td><code>value_type</code> is <code>CopyInsertable</code> into <code>X</code>, <code>key_type</code> is <code>CopyAssignable</code>, and
<code>mapped_type</code> is <code>CopyAssignable</code> (for containers having a <code>mapped_type</code>)</td>    
</tr>

<tr> 
<td><code>T</code> is <code>CopyInsertable</code></td>                                                
<td><code>value_type</code> is CopyInsertable</td> 
</tr>

<tr> 
<td><code>T</code> shall be <code>CopyInsertable</code></td>                                          
<td><code>value_type</code> shall be CopyInsertable</td> 
</tr>

<tr> 
<td><code>T</code> shall be <code>MoveInsertable</code></td>                                          
<td><code>value_type</code> shall be MoveInsertable</td> 
</tr>

<tr> 
<td><code>T</code> shall be <code>EmplaceConstructible</code></td>                                    
<td><code>value_type</code> shall be EmplaceConstructible</td> 
</tr>

<tr> 
<td><code>T</code> object</td>                                                                    
<td><code>value_type</code> object</td> 
</tr>
</table>

<p><i>[
<b>Notes to the editor</b>: The above are carefully selected 
phrases that can be used for global search-and-replace within 
the specified sections without accidentally making changes to 
correct uses <code>T</code>.
]</i></p>






</body>
</html>
