Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56973 - sandbox/committee/rvalue_ref
From: dave_at_[hidden]
Date: 2009-10-17 22:06:56


Author: dave
Date: 2009-10-17 22:06:55 EDT (Sat, 17 Oct 2009)
New Revision: 56973
URL: http://svn.boost.org/trac/boost/changeset/56973

Log:
Fix up the standard wording again. Rani was right all along, of
course.

Text files modified:
   sandbox/committee/rvalue_ref/N2983-throwing-move.rst | 100 +++++++++++++++++++++++----------------
   sandbox/committee/rvalue_ref/N2983.html | 94 ++++++++++++++++++++++---------------
   2 files changed, 114 insertions(+), 80 deletions(-)

Modified: sandbox/committee/rvalue_ref/N2983-throwing-move.rst
==============================================================================
--- sandbox/committee/rvalue_ref/N2983-throwing-move.rst (original)
+++ sandbox/committee/rvalue_ref/N2983-throwing-move.rst 2009-10-17 22:06:55 EDT (Sat, 17 Oct 2009)
@@ -82,10 +82,9 @@
 move can disturb existing guarantees. We propose that instead of
 using ``std::move(x)`` in those cases, thus granting permission for
 the compiler to use *any* available move constructor, maintainers of
-these particular operations should use
-``std::legacy_move(x)``, which only grants
-permission to use the non-throwing move constructors of copyable
-types. Unless ``x`` is a move-only type, or is known to have a
+these particular operations should use ``std::legacy_move(x)``, which
+grants permission move *unless* it could throw and the type is
+copyable. Unless ``x`` is a move-only type, or is known to have a
 nonthrowing move constructor, the operation would fall back to copying
 ``x``, just as though ``x`` had never acquired a move constructor at
 all.
@@ -132,12 +131,13 @@
   }
 
 
-We stress again that the use of ``std::legacy_move`` as opposed to ``move``
-would only be necessary under an *extremely* limited set of
+We stress again that the use of ``std::legacy_move`` as opposed to
+``move`` would only be necessary under an *extremely* limited set of
 circumstances. In particular, it would never be required in new code,
 which could simply give a *conditional* strong guarantee, e.g. “if an
-exception is thrown other than by ``T``\ 's move constructor, there are
-no effects.” We recommend that approach as best practice for new code.
+exception is thrown other than by ``T``\ 's move constructor, there
+are no effects.” We recommend that approach as best practice for new
+code.
 
 Implementing ``std::legacy_move``
 *********************************
@@ -148,7 +148,7 @@
   typename conditional<
       !has_nothrow_move_constructor<T>::value
       && has_copy_constructor<T>::value,
- T&,
+ T const&,
       T&&
>::type
   legacy_move(T& x)
@@ -333,7 +333,7 @@
 | ``template <class T> |``T`` has a move |``T`` shall be a complete type. |
 | struct has_move_constructor;`` |constructor (17.3.14). | |
 +--------------------------------+---------------------------+-----------------------------------+
-| ``template <class T> |``T`` is a type with a move|``has_move_constructor<T>::value`` |
+| ``template <class T> |``T`` is a type with a move|``T`` shall be a complete type. |
 | struct |constructor that is known | |
 | has_nothrow_move_constructor;``|not to throw any | |
 | |exceptions. | |
@@ -341,7 +341,7 @@
 | ``template <class T> |``T`` has a move assignment|``T`` shall be a complete type. |
 | struct has_move_assign;`` |operator (17.3.13). | |
 +--------------------------------+---------------------------+-----------------------------------+
-| ``template <class T> |``T`` is a type with a move|``has_move_assign<T>::value`` |
+| ``template <class T> |``T`` is a type with a move|``T`` shall be a complete type. |
 | struct |assignment operator that is| |
 | has_nothrow_move_assign;`` |known not to throw any | |
 | |exceptions. | |
@@ -365,11 +365,38 @@
 23.3.2.3 deque modifiers [deque.modifiers]
 ==========================================
 
-Change paragraph 2 as follows:
+Context::
 
- 2 Remarks: If an exception is thrown other than by the copy constructor,
- :ins:`move constructor, move assignment operator`
- or assignment operator of ``T`` there are no effects.
+ iterator insert(const_iterator position, const T& x);
+ iterator insert(const_iterator position, T&& x);
+ void insert(const_iterator position, size_type n, const T& x);
+ template <class InputIterator>;
+ void insert(const_iterator position, ;
+ InputIterator first, InputIterator last);
+
+ template <class... Args> void emplace_front(Args&&... args);
+ template <class... Args> void emplace_back(Args&&... args);
+ template <class... Args> iterator emplace(const_iterator position, Args&&... args);
+ void push_front(const T& x);
+ void push_front(T&& x);
+ void push_back(const T& x);
+ void push_back(T&& x);`
+
+Change Paragraph 2 as follows:
+
+ 2 Remarks: If an exception is thrown other than by the copy
+ constructor\ :ins:`, move constructor, move assignment operator` or
+ assignment operator of ``T`` there are no effects. :raw-html:`<span
+ class="ins">If an exception is thrown by the move constructor of a
+ non-CopyConstructible <code>T</code>, the effects are
+ unspecified.</span>`
+
+-----
+
+Context::
+
+ iterator erase(const_iterator position);
+ iterator erase(const_iterator first, const_iterator last);
 
 Change paragraph 6 as follows:
 
@@ -391,7 +418,7 @@
 
 Change paragraph 3 as follows:
 
- Effects: A directive that informs a vector of a planned change in
+ :del:`3`:ins:`2` Effects: A directive that informs a vector of a planned change in
     size, so that it can manage the storage allocation
     accordingly. After ``reserve()``, ``capacity()`` is greater or
     equal to the argument of reserve if reallocation happens; and
@@ -426,37 +453,26 @@
     void insert(const_iterator position, size_type n, const T& x);
     template <class InputIterator>
       void insert(const_iterator position, InputIterator first, InputIterator last);
- :del:`template <class... Args> void emplace_back(Args&&... args);`
- template <class... Args> iterator emplace(const_iterator position, Args&&... args);
- :del:`void push_back(const T& x);
- void push_back(T&& x);`
+ template <class... Args> void emplace_back(Args&&... args);
+ template <class... Args> iterator emplace(const_iterator position, Args&&... args);
+ void push_back(const T& x);
+ void push_back(T&& x);
 
   :del:`1 Requires: If value_type has a move constructor, that constructor shall
   not throw any exceptions.`
 
- :del:`2`:ins:`1` Remarks: Causes reallocation if the new size is greater than the
- old capacity. If no reallocation happens, all the iterators and
- references before the insertion point remain valid. If an exception
- is thrown other than by the copy constructor :ins:`move constructor,
- move assignment operator,` or assignment operator of ``T`` or by any
- InputIterator operation there are no effects.
-
- :del:`3`:ins:`2` Complexity: The complexity is linear in the number of elements
- inserted plus the distance to the end of the vector.
-
- .. parsed-literal::
-
- :ins:`void push_back(const T& x);
- void push_back(T&& x);
- template <class... Args> void emplace_back(Args&&... args);`
-
- :ins:`2 Remarks: Causes reallocation if the new size is greater than
- the old capacity. If no reallocation happens, all iterators and
- references remain valid. Otherwise, if an exception is thrown by
- the move constructor of a non-CopyConstructible type, the effects
- are unspecified.`
+ :del:`2`:ins:`1` Remarks: Causes reallocation if the new size is
+ greater than the old capacity. If no reallocation happens, all the
+ iterators and references before the insertion point remain valid.
+ If an exception is thrown other than by the copy constructor
+ :ins:`move constructor, move assignment operator,` or assignment
+ operator of ``T`` or by any InputIterator operation there are no
+ effects. :raw-html:`<span class="ins">if an exception is thrown by
+ the move constructor of a non-CopyConstructible <code>T</code>, the
+ effects are unspecified.`
 
- :ins:`Complexity: O(1)`
+ :del:`3`:ins:`2` Complexity: The complexity is linear in the number
+ of elements inserted plus the distance to the end of the vector.
 
 **Note to proposal reader:** The strong guarantee of ``push_back`` for
 CopyConstructible ``T``\ s is maintained by virtue of 23.2.1

Modified: sandbox/committee/rvalue_ref/N2983.html
==============================================================================
--- sandbox/committee/rvalue_ref/N2983.html (original)
+++ sandbox/committee/rvalue_ref/N2983.html 2009-10-17 22:06:55 EDT (Sat, 17 Oct 2009)
@@ -398,10 +398,9 @@
 move can disturb existing guarantees. We propose that instead of
 using <tt class="docutils literal"><span class="pre">std::move(x)</span></tt> in those cases, thus granting permission for
 the compiler to use <em>any</em> available move constructor, maintainers of
-these particular operations should use
-<tt class="docutils literal"><span class="pre">std::legacy_move(x)</span></tt>, which only grants
-permission to use the non-throwing move constructors of copyable
-types. Unless <tt class="docutils literal"><span class="pre">x</span></tt> is a move-only type, or is known to have a
+these particular operations should use <tt class="docutils literal"><span class="pre">std::legacy_move(x)</span></tt>, which
+grants permission move <em>unless</em> it could throw and the type is
+copyable. Unless <tt class="docutils literal"><span class="pre">x</span></tt> is a move-only type, or is known to have a
 nonthrowing move constructor, the operation would fall back to copying
 <tt class="docutils literal"><span class="pre">x</span></tt>, just as though <tt class="docutils literal"><span class="pre">x</span></tt> had never acquired a move constructor at
 all.</p>
@@ -444,12 +443,13 @@
     }
 }
 </pre>
-<p>We stress again that the use of <tt class="docutils literal"><span class="pre">std::legacy_move</span></tt> as opposed to <tt class="docutils literal"><span class="pre">move</span></tt>
-would only be necessary under an <em>extremely</em> limited set of
+<p>We stress again that the use of <tt class="docutils literal"><span class="pre">std::legacy_move</span></tt> as opposed to
+<tt class="docutils literal"><span class="pre">move</span></tt> would only be necessary under an <em>extremely</em> limited set of
 circumstances. In particular, it would never be required in new code,
 which could simply give a <em>conditional</em> strong guarantee, e.g. “if an
-exception is thrown other than by <tt class="docutils literal"><span class="pre">T</span></tt>'s move constructor, there are
-no effects.” We recommend that approach as best practice for new code.</p>
+exception is thrown other than by <tt class="docutils literal"><span class="pre">T</span></tt>'s move constructor, there
+are no effects.” We recommend that approach as best practice for new
+code.</p>
 </div>
 <div class="section" id="implementing-std-legacy-move">
 <h1><a class="toc-backref" href="#id9">Implementing <tt class="docutils literal"><span class="pre">std::legacy_move</span></tt></a></h1>
@@ -459,7 +459,7 @@
 typename conditional&lt;
     !has_nothrow_move_constructor&lt;T&gt;::value
     &amp;&amp; has_copy_constructor&lt;T&gt;::value,
- T&amp;,
+ T const&amp;,
     T&amp;&amp;
 &gt;::type
 legacy_move(T&amp; x)
@@ -630,7 +630,7 @@
 constructor that is known
 not to throw any
 exceptions.</td>
-<td><tt class="docutils literal"><span class="pre">has_move_constructor&lt;T&gt;::value</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">T</span></tt> shall be a complete type.</td>
 </tr>
 <tr><td><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">T&gt;</span>
 <span class="pre">struct</span> <span class="pre">has_move_assign;</span></tt></td>
@@ -645,7 +645,7 @@
 assignment operator that is
 known not to throw any
 exceptions.</td>
-<td><tt class="docutils literal"><span class="pre">has_move_assign&lt;T&gt;::value</span></tt></td>
+<td><tt class="docutils literal"><span class="pre">T</span></tt> shall be a complete type.</td>
 </tr>
 <tr><td><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">T&gt;</span>
 <span class="pre">struct</span> <span class="pre">has_copy_constructor;</span></tt></td>
@@ -677,11 +677,37 @@
 </div>
 <div class="section" id="deque-modifiers-deque-modifiers">
 <h2><a class="toc-backref" href="#id18">23.3.2.3 deque modifiers [deque.modifiers]</a></h2>
-<p>Change paragraph 2 as follows:</p>
+<p>Context:</p>
+<pre class="literal-block">
+iterator insert(const_iterator position, const T&amp; x);
+iterator insert(const_iterator position, T&amp;&amp; x);
+void insert(const_iterator position, size_type n, const T&amp; x);
+template &lt;class InputIterator&gt;;
+ void insert(const_iterator position, ;
+ InputIterator first, InputIterator last);
+
+template &lt;class... Args&gt; void emplace_front(Args&amp;&amp;... args);
+template &lt;class... Args&gt; void emplace_back(Args&amp;&amp;... args);
+template &lt;class... Args&gt; iterator emplace(const_iterator position, Args&amp;&amp;... args);
+void push_front(const T&amp; x);
+void push_front(T&amp;&amp; x);
+void push_back(const T&amp; x);
+void push_back(T&amp;&amp; x);`
+</pre>
+<p>Change Paragraph 2 as follows:</p>
 <blockquote>
-2 Remarks: If an exception is thrown other than by the copy constructor,
-<span class="ins">move constructor, move assignment operator</span>
-or assignment operator of <tt class="docutils literal"><span class="pre">T</span></tt> there are no effects.</blockquote>
+2 Remarks: If an exception is thrown other than by the copy
+constructor<span class="ins">, move constructor, move assignment operator</span> or
+assignment operator of <tt class="docutils literal"><span class="pre">T</span></tt> there are no effects. <span class="raw-html"><span
+class="ins">If an exception is thrown by the move constructor of a
+non-CopyConstructible <code>T</code>, the effects are
+unspecified.</span></span></blockquote>
+<hr class="docutils" />
+<p>Context:</p>
+<pre class="literal-block">
+iterator erase(const_iterator position);
+iterator erase(const_iterator first, const_iterator last);
+</pre>
 <p>Change paragraph 6 as follows:</p>
 <blockquote>
 6 Throws: Nothing unless an exception is thrown by the copy constructor,
@@ -700,7 +726,7 @@
 not throw any exceptions.</span></blockquote>
 <p>Change paragraph 3 as follows:</p>
 <blockquote>
-Effects: A directive that informs a vector of a planned change in
+<span class="del">3</span><span class="ins">2</span> Effects: A directive that informs a vector of a planned change in
 size, so that it can manage the storage allocation
 accordingly. After <tt class="docutils literal"><span class="pre">reserve()</span></tt>, <tt class="docutils literal"><span class="pre">capacity()</span></tt> is greater or
 equal to the argument of reserve if reallocation happens; and
@@ -731,32 +757,24 @@
 void insert(const_iterator position, size_type n, const T&amp; x);
 template &lt;class InputIterator&gt;
   void insert(const_iterator position, InputIterator first, InputIterator last);
-<span class="del">template &lt;class... Args&gt; void emplace_back(Args&amp;&amp;... args);</span>
+template &lt;class... Args&gt; void emplace_back(Args&amp;&amp;... args);
 template &lt;class... Args&gt; iterator emplace(const_iterator position, Args&amp;&amp;... args);
-<span class="del">void push_back(const T&amp; x);
-void push_back(T&amp;&amp; x);</span>
+void push_back(const T&amp; x);
+void push_back(T&amp;&amp; x);
 </pre>
 <p><span class="del">1 Requires: If value_type has a move constructor, that constructor shall
 not throw any exceptions.</span></p>
-<p><span class="del">2</span><span class="ins">1</span> Remarks: Causes reallocation if the new size is greater than the
-old capacity. If no reallocation happens, all the iterators and
-references before the insertion point remain valid. If an exception
-is thrown other than by the copy constructor <span class="ins">move constructor,
-move assignment operator,</span> or assignment operator of <tt class="docutils literal"><span class="pre">T</span></tt> or by any
-InputIterator operation there are no effects.</p>
-<p><span class="del">3</span><span class="ins">2</span> Complexity: The complexity is linear in the number of elements
-inserted plus the distance to the end of the vector.</p>
-<pre class="literal-block">
-<span class="ins">void push_back(const T&amp; x);
-void push_back(T&amp;&amp; x);
-template &lt;class... Args&gt; void emplace_back(Args&amp;&amp;... args);</span>
-</pre>
-<p><span class="ins">2 Remarks: Causes reallocation if the new size is greater than
-the old capacity. If no reallocation happens, all iterators and
-references remain valid. Otherwise, if an exception is thrown by
-the move constructor of a non-CopyConstructible type, the effects
-are unspecified.</span></p>
-<p><span class="ins">Complexity: O(1)</span></p>
+<p><span class="del">2</span><span class="ins">1</span> Remarks: Causes reallocation if the new size is
+greater than the old capacity. If no reallocation happens, all the
+iterators and references before the insertion point remain valid.
+If an exception is thrown other than by the copy constructor
+<span class="ins">move constructor, move assignment operator,</span> or assignment
+operator of <tt class="docutils literal"><span class="pre">T</span></tt> or by any InputIterator operation there are no
+effects. <span class="raw-html"><span class="ins">if an exception is thrown by
+the move constructor of a non-CopyConstructible <code>T</code>, the
+effects are unspecified.</span></p>
+<p><span class="del">3</span><span class="ins">2</span> Complexity: The complexity is linear in the number
+of elements inserted plus the distance to the end of the vector.</p>
 </blockquote>
 <p><strong>Note to proposal reader:</strong> The strong guarantee of <tt class="docutils literal"><span class="pre">push_back</span></tt> for
 CopyConstructible <tt class="docutils literal"><span class="pre">T</span></tt>s is maintained by virtue of 23.2.1


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk