<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2518: [fund.ts.v2] Non-member swap for propagate_const should call member swap</title>
<meta property="og:title" content="Issue 2518: [fund.ts.v2] Non-member swap for propagate_const should call member swap">
<meta property="og:description" content="C++ library issue. Status: TS">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2518.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="2518"><a href="lwg-defects.html#2518">2518</a>. [fund.ts.v2] Non-member <code>swap</code> for <code>propagate_const</code> should call member <code>swap</code></h3>
<p><b>Section:</b> 3.7.10 <a href="https://cplusplus.github.io/fundamentals-ts/v2.html#propagate_const.algorithms">[fund.ts.v2::propagate_const.algorithms]</a> <b>Status:</b> <a href="lwg-active.html#TS">TS</a>
 <b>Submitter:</b> Tim Song <b>Opened:</b> 2015-07-08 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>3
</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>
For consistency with the rest of the standard library, the non-member <code>swap</code> for <code>propagate_const</code> should 
call member <code>swap</code>.
</p>

<p><i>[2015-07, Telecon]</i></p>

<p>
Both P3 and NAD were suggested.
</p>

<p><i>[2016-02-20, Ville comments]</i></p>

<p>
Feedback from an implementation:
<p/>
The implementation of <code>propagate_const</code> in libstdc++ calls <code>propagate_const</code>'s
member <code>swap</code> from the non-member <code>swap</code>.
</p>

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

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


<p id="res-2518"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4529.html">N4529</a>.
</p>

<ol>
<li><p>Edit [propagate_const.algorithms] as indicated:</p>
<blockquote>
<pre>
-1- template &lt;class T&gt;
constexpr void swap(propagate_const&lt;T&gt;&amp; pt1, propagate_const&lt;T&gt;&amp; pt2) noexcept(<i>see below</i>)
</pre>
<blockquote>
<p>
-2- The constant-expression in the exception-specification is <code>noexcept(<del>swap(pt1.t_, pt2.t_)</del><ins>pt1.swap(pt2)</ins>)</code>.
<p/>
-3- <i>Effects</i>: <code><del>swap(pt1.t_, pt2.t_)</del><ins>pt1.swap(pt2)</ins></code>. 
</p>
</blockquote>
</blockquote>
</li>
</ol>





</body>
</html>
