<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>US 108</title>

<style type="text/css">
  p {text-align:justify}
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  blockquote.note
  {
   background-color:#E0E0E0;
   padding-left: 15px;
   padding-right: 15px;
   padding-top: 1px;
   padding-bottom: 1px;
  }
</style>
</head><body>
<address style="text-align: left;">
Document number: N3109=10-0099<br>
Project: Programming Language C++, Library Working Group<br>
Author: <a href="mailto:daniel.kruegler@googlemail.com">Daniel Krgler</a><br>

Date: 2010-08-06
</address>
<hr>
<h1 style="text-align: center;">US 108</tt></h1>

<h2><a name="Discussion"></a>Discussion</h2>
This proposal addresses US comment 108, thus attempts to resolve the current <tt>auto_ptr</tt> => <tt>unique_ptr/shared_ptr</tt>
conversion mismatch. The proposed resolution intentionally deviates from the form suggested by the NB comment: Instead of adding an 
explicit constructor template to <tt>shared_ptr</tt> that accepts an lvalue of <tt>auto_ptr</tt>, it suggests to remove the
explicit constructor template of <tt>unique_ptr</tt> instead and allow only movements from rvalues. The rationale for this deviation
is that in C++0x it is intended to deprecate <tt>auto_ptr</tt> and its funny move-from-lvalue semantics. Therefore, the existing
constructors should satisfy the following two aims: Providing an easy transition path for users of <tt>auto_ptr</tt> but doing this
in the spirit of C++0x, i.e. users can still move an lvalue, but that requires an explicit usage of <tt>std::move()</tt>.
<p>
<h2><a name="Proposed_resolution"></a>Proposed resolution</h2>
<p>
<ol>
<li>Remove from the class template synopsis, 20.9.10.2 unique_ptr for single objects [unique.ptr.single]:
<blockquote><pre>
namespace std {
  template &lt;class T, class D = default_delete&lt;T&gt;&gt; class unique_ptr {
  public:
    ...
    template &lt;class U, class E&gt;
    unique_ptr(unique_ptr&lt;U, E&gt;&amp;&amp; u);
    <del>template &lt;class U&gt;</del>
    <del>explicit unique_ptr(auto_ptr&lt;U&gt;&amp; u);</del>
    template &lt;class U&gt;
    unique_ptr(auto_ptr&lt;U&gt;&amp;&amp; u);
    ...
  };
}
</pre></blockquote>
</li>
<li>Remove the superfluous prototype signature from 20.9.10.2.1 [unique.ptr.single.ctor] before p. 27 and fix some plural form that is now supposed to be a singular form:
<blockquote><pre>
  <del>template &lt;class U&gt;</del>
  <del>explicit unique_ptr(auto_ptr&lt;U&gt;&amp; u);</del>
  template &lt;class U&gt;
  unique_ptr(auto_ptr&lt;U&gt;&amp;&amp; u);
 </pre><p>
 27 Effects: Constructs a unique_ptr object, initializing the stored pointer with u.release() and value-initializing
the stored deleter.<p>
28 Postconditions: get() yields the value u.get() yielded before the construction. u.get() == nullptr.
get_deleter() returns a reference to the stored deleter.<p>
29 Throws: Nothing.<p>
30 Remarks: <del>These constructors</del><ins>This constructor</ins> shall not participate in overload resolution unless U* is implictly convertible
to T* and D is the same type as default_delete&lt;T&gt;.
 </blockquote>
</li>
</ol>
<p>

</p>
</body></html>
