<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2103: std::allocator_traits&lt;std::allocator&lt;T&gt;&gt;::propagate_on_container_move_assignment</title>
<meta property="og:title" content="Issue 2103: std::allocator_traits&lt;std::allocator&lt;T&gt;&gt;::propagate_on_container_move_assignment">
<meta property="og:description" content="C++ library issue. Status: C++14">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2103.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++14">C++14</a> status.</em></p>
<h3 id="2103"><a href="lwg-defects.html#2103">2103</a>. <code>std::allocator_traits&lt;std::allocator&lt;T&gt;&gt;::propagate_on_container_move_assignment</code></h3>
<p><b>Section:</b> 20.2.10 <a href="https://wg21.link/default.allocator">[default.allocator]</a> <b>Status:</b> <a href="lwg-active.html#C++14">C++14</a>
 <b>Submitter:</b> Ai Azuma <b>Opened:</b> 2011-11-08 <b>Last modified:</b> 2016-01-28</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View other</b> <a href="lwg-index-open.html#default.allocator">active issues</a> in [default.allocator].</p>
<p><b>View all other</b> <a href="lwg-index.html#default.allocator">issues</a> in [default.allocator].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++14">C++14</a> status.</p>
<p><b>Discussion:</b></p>

<p>
&quot;<code>std::allocator_traits&lt;std::allocator&lt;T&gt;&gt;::propagate_on_container_move_assignment::value</code>&quot;
is specified as &quot;false&quot;, according to (20.2.10 <a href="https://wg21.link/default.allocator">[default.allocator]</a>) and (20.2.9.2 <a href="https://wg21.link/allocator.traits.types">[allocator.traits.types]</a>).
However, according to (23.2.2 <a href="https://wg21.link/container.requirements.general">[container.requirements.general]</a>), this specification leads to the unneeded requirements
(<code>MoveInsertable</code> and <code>MoveAssignable</code> of the value type) on the move assignment operator of containers
with the default allocator. 
<p/>
Proposed resolution:
<p/>
Either of the following two changes;  
</p>
<ol>
<li>
adding the nested typedef like
&quot;<code>typedef std::true_type propagate_on_container_move_assignment;</code>&quot;
in the definition of <code>std::allocator</code> class template,
</li>
<li>
adding the explicit partial specialization of
&quot;<code>std::allocator_traits</code>&quot; class template for &quot;<code>std::allocator</code>&quot;
class template, in which &quot;<code>propagate_on_container_move_assignment</code>&quot;
nested typedef is specified as &quot;<code>std::true_type</code>&quot;. 
</li>
</ol>
<p>
Pablo prefers the first resolution.
</p>

<p><i>[2011-12-02: Pablo comments]</i></p>


<p>
This issue has potentially some overlap with <a href="lwg-defects.html#2108" title="No way to identify allocator types that always compare equal (Status: Resolved)">2108</a><sup><a href="https://cplusplus.github.io/LWG/issue2108" title="Latest snapshot">(i)</a></sup>. Should the trait <code>always_compare_equal</code>
been added, this issue's resolution should be improved based on that.
</p>

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

<p>
Move to Ready.
</p>

<p><i>[2012, Portland: applied to WP]</i></p>




<p id="res-2103"><b>Proposed resolution:</b></p>
<p>This wording is relative to the FDIS.</p>

<p>Change 20.2.10 <a href="https://wg21.link/default.allocator">[default.allocator]</a>, the class template <code>allocator</code> synopsis as indicated:</p>

<blockquote><pre>
namespace std {
  template &lt;class T&gt; class allocator;

  <i>// specialize for <code>void</code>:</i>
  template &lt;&gt; class allocator&lt;void&gt; {
  public:
    typedef void* pointer;
    typedef const void* const_pointer;
    <i>// reference-to-<code>void</code> members are impossible.</i>
    typedef void value_type;
    template &lt;class U&gt; struct rebind { typedef allocator&lt;U&gt; other; };
  };

  template &lt;class T&gt; class allocator {
  public:
    typedef size_t size_type;
    typedef ptrdiff_t difference_type;
    typedef T* pointer;
    typedef const T* const_pointer;
    typedef T&amp; reference;
    typedef const T&amp; const_reference;
    typedef T value_type;
    template &lt;class U&gt; struct rebind { typedef allocator&lt;U&gt; other; };
    <ins>typedef true_type propagate_on_container_move_assignment;</ins>

    [&hellip;]
  };
}
</pre></blockquote>






</body>
</html>
