|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56936 - sandbox/committee/rvalue_ref
From: dave_at_[hidden]
Date: 2009-10-16 20:54:43
Author: dave
Date: 2009-10-16 20:54:42 EDT (Fri, 16 Oct 2009)
New Revision: 56936
URL: http://svn.boost.org/trac/boost/changeset/56936
Log:
Attempt to fix guarantees for vector's push_back by separating it from
insert
Text files modified:
sandbox/committee/rvalue_ref/N2983-throwing-move.rst | 49 ++++++++++++++++++++++++++-------------
sandbox/committee/rvalue_ref/N2983.html | 46 +++++++++++++++++++++++-------------
2 files changed, 61 insertions(+), 34 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-16 20:54:42 EDT (Fri, 16 Oct 2009)
@@ -362,7 +362,6 @@
| | | |
+--------------------------------+---------------------------+-----------------------------------+
-
23.3.2.3 deque modifiers [deque.modifiers]
==========================================
@@ -418,34 +417,50 @@
23.3.6.4 vector modifiers [vector.modifiers]
============================================
-Context::
+Change the section as follows:
+
+ .. parsed-literal::
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_back(Args&&... args);
+ :del:`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:`void push_back(const T& x);
+ void push_back(T&& x);`
-Delete paragraph 1:
+ :del:`1 Requires: If value_type has a move constructor, that constructor shall
+ not throw any exceptions.`
- :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.
-Change paragraph 2 as follows:
+ :del:`3`:ins:`2` Complexity: The complexity is linear in the number of elements
+ inserted plus the distance to the end of the vector.
- 2 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.
+ .. parsed-literal::
+
+ :ins:`void push_back(const T& x);
+ void push_back(T&& x);
+ template <class... Args> void emplace_back(Args&&... args);`
-**Note:** The strong guarantee of ``push_back`` is maintained by
-paragraph 11 in 23.2.1 [container.requirements.general]
+ :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.`
+
+ :ins:`Complexity: O(1)`
+
+**Note to proposal reader:** The strong guarantee of ``push_back`` for
+CopyConstructible ``T``\ s is maintained by virtue of 23.2.1
+[container.requirements.general] paragraph 11.
-----
Modified: sandbox/committee/rvalue_ref/N2983.html
==============================================================================
--- sandbox/committee/rvalue_ref/N2983.html (original)
+++ sandbox/committee/rvalue_ref/N2983.html 2009-10-16 20:54:42 EDT (Fri, 16 Oct 2009)
@@ -723,32 +723,44 @@
</div>
<div class="section" id="vector-modifiers-vector-modifiers">
<h2><a class="toc-backref" href="#id20">23.3.6.4 vector modifiers [vector.modifiers]</a></h2>
-<p>Context:</p>
+<p>Change the section as follows:</p>
+<blockquote>
<pre class="literal-block">
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_back(Args&&... args);
+<span class="del">template <class... Args> void emplace_back(Args&&... args);</span>
template <class... Args> iterator emplace(const_iterator position, Args&&... args);
-void push_back(const T& x);
-void push_back(T&& x);
+<span class="del">void push_back(const T& x);
+void push_back(T&& x);</span>
</pre>
-<p>Delete paragraph 1:</p>
-<blockquote>
-<span class="del">1 Requires: If value_type has a move constructor, that constructor shall
-not throw any exceptions.</span></blockquote>
-<p>Change paragraph 2 as follows:</p>
-<blockquote>
-2 Remarks: Causes reallocation if the new size is greater than the
+<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 T
-or by any InputIterator operation there are no effects.</blockquote>
-<p><strong>Note:</strong> The strong guarantee of <tt class="docutils literal"><span class="pre">push_back</span></tt> is maintained by
-paragraph 11 in 23.2.1 [container.requirements.general]</p>
+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& x);
+void push_back(T&& x);
+template <class... Args> void emplace_back(Args&&... 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>
+</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
+[container.requirements.general] paragraph 11.</p>
<hr class="docutils" />
<p>Context:</p>
<pre class="literal-block">
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