Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51930 - sandbox/committee/rvalue_ref
From: dgregor_at_[hidden]
Date: 2009-03-23 01:26:12


Author: dgregor
Date: 2009-03-23 01:26:11 EDT (Mon, 23 Mar 2009)
New Revision: 51930
URL: http://svn.boost.org/trac/boost/changeset/51930

Log:
Finished up the first full draft
Text files modified:
   sandbox/committee/rvalue_ref/rvalue-ref-exception-safety.html | 82 ++++++++++++++++++++++++---------------
   1 files changed, 51 insertions(+), 31 deletions(-)

Modified: sandbox/committee/rvalue_ref/rvalue-ref-exception-safety.html
==============================================================================
--- sandbox/committee/rvalue_ref/rvalue-ref-exception-safety.html (original)
+++ sandbox/committee/rvalue_ref/rvalue-ref-exception-safety.html 2009-03-23 01:26:11 EDT (Mon, 23 Mar 2009)
@@ -676,40 +676,40 @@
 <p>We propose the introduction of new concepts for non-throwing assignment and construction:</p>
 
 <pre>
-auto concept NothrowConstructible&lt;typename T, typename... Args&gt;
- : Constructible&lt;T, Args...&gt; {
- noexcept T::T(Args...);
-}
-
-auto concept NothrowMoveConstructible&lt;typename T&gt; : MoveConstructible&lt;T&gt; {
- requires RvalueOf&lt;T&gt;
- &amp;&amp; NothrowConstructible&lt;T, RvalueOf&lt;T&gt;::type&gt;;
-}
-
-auto concept HasNothrowAssign&lt;typename T, typename U&gt; : HasAssign&lt;T, U&gt; {
- noexcept result_type T::operator=(U);
-}
+<ins>auto concept NothrowConstructible&lt;typename T, typename... Args&gt;
+<ins> : Constructible&lt;T, Args...&gt; {</ins>
+<ins> noexcept T::T(Args...);</ins>
+<ins>}</ins>
+
+<ins>auto concept NothrowMoveConstructible&lt;typename T&gt; : MoveConstructible&lt;T&gt; {</ins>
+<ins> requires RvalueOf&lt;T&gt;</ins>
+<ins> &amp;&amp; NothrowConstructible&lt;T, RvalueOf&lt;T&gt;::type&gt;;</ins>
+<ins>}</ins>
+
+<ins>auto concept HasNothrowAssign&lt;typename T, typename U&gt; : HasAssign&lt;T, U&gt; {</ins>
+<ins> noexcept result_type T::operator=(U);</ins>
+<ins>}</ins>
 
-auto concept NothrowMoveAssignable&lt;typename T&gt; : MoveAssignable&lt;T&gt;, HasNothrowAssign&lt;T, T&amp;&amp;&gt; { }
+<ins>auto concept NothrowMoveAssignable&lt;typename T&gt; : MoveAssignable&lt;T&gt;, HasNothrowAssign&lt;T, T&amp;&amp;&gt; { }</ins>
 </pre>
 
 <p>In addition, we need <code>Nothrow</code> variants of the concepts used for scoped allocators:</p>
 
 <pre>
-concept NothrowConstructibleWithAllocator&lt;class T, class Alloc, class... Args&gt; {
- noexcept T::T(allocator_arg_t, Alloc, Args&amp;&amp;...);
-}
-
-auto concept NothrowAllocatableElement&lt;class Alloc, class T, class... Args&gt; : AllocatableElement&lt;Alloc, T, Args...&gt; {
- noexcept void Alloc::construct(T*, Args&amp;&amp;...);
-}
+<ins>concept NothrowConstructibleWithAllocator&lt;class T, class Alloc, class... Args&gt; {</ins>
+<ins> noexcept T::T(allocator_arg_t, Alloc, Args&amp;&amp;...);</ins>
+<ins>}</ins>
+
+<ins>auto concept NothrowAllocatableElement&lt;class Alloc, class T, class... <ins>Args&gt; : AllocatableElement&lt;Alloc, T, Args...&gt; {</ins>
+<ins> noexcept void Alloc::construct(T*, Args&amp;&amp;...);</ins>
+<ins>}</ins>
 </pre>
 
 <p>Finally, we improve the existing <code>NothrowDestructible</code> concept to statically check the no-throw requirements:</p>
 
 <pre>
 auto concept NothrowDestructible&lt;typename T&gt; : HasDestructor&lt;T&gt; {
- noexcept T::~T();
+ <ins>noexcept T::~T();</ins>
 }
 </pre>
 
@@ -723,19 +723,19 @@
 <pre>
 template&lt;class U, class V&gt;
   requires <ins>Nothrow</ins>Constructible&lt;T1, RvalueOf&lt;U&gt;::type&gt; &amp;&amp; <ins>Nothrow</ins>Constructible&lt;T2, RvalueOf&lt;V&gt;::type&gt;
- pair(pair&lt;U, V&gt;&amp;&amp; p);
+ <ins>noexcept</ins> pair(pair&lt;U, V&gt;&amp;&amp; p);
 
 template&lt;class U, class V, Allocator Alloc&gt;
   requires <ins>Nothrow</ins>ConstructibleWithAllocator&lt;T1, Alloc, RvalueOf&lt;U&gt;::type&gt;
         &amp;&amp; <ins>Nothrow</ins>ConstructibleWithAllocator&lt;T2, Alloc, RvalueOf&lt;V&gt;::type&gt;
- pair(allocator_arg_t, const Alloc& a, pair&lt;U, V&gt;&amp;&amp; p);
+ <ins>noexcept</ins> pair(allocator_arg_t, const Alloc& a, pair&lt;U, V&gt;&amp;&amp; p);
 </pre>
 
 <p>Similarly, <code>pair</code>'s move assignment operator will be modified as follows:</p>
 <pre>
 template&lt;class U , class V&gt;
   requires Has<ins>Nothrow</ins>Assign&lt;T1, RvalueOf&lt;U&gt;::type&gt; &amp;&amp; Has<ins>Nothrow</ins>Assign&lt;T2, RvalueOf&lt;V&gt;::type&gt;
- pair&amp; operator=(pair&lt;U , V&gt;&amp;&amp; p);
+ <ins>noexcept</ins> pair&amp; operator=(pair&lt;U , V&gt;&amp;&amp; p);
 </pre>
 
 <h5>20.5.2 Class template tuple [tuple.tuple]</h5>
@@ -745,11 +745,11 @@
 <pre>
 template &lt;class... UTypes&gt;
   requires <ins>Nothrow</ins>Constructible&lt;Types, RvalueOf&lt;UTypes&gt;::type&gt;...
- tuple(tuple&lt;UTypes...&gt;&amp;&amp;);
+ <ins>noexcept</ins> tuple(tuple&lt;UTypes...&gt;&amp;&amp;);
 
 template &lt;Allocator Alloc, class... UTypes&gt;
   requires <ins>Nothrow</ins>ConstructibleWithAllocator&lt;Types, Alloc, RvalueOf&lt;UTypes&gt;::type&gt;...
- tuple(allocator_arg_t, const Alloc&amp; a, tuple&lt;UTypes...&gt;&amp;&amp;);
+ <ins>noexcept</ins> tuple(allocator_arg_t, const Alloc&amp; a, tuple&lt;UTypes...&gt;&amp;&amp;);
 </pre>
 
 <p><code>tuple</code>'s move assignment operator will be modified as follows:</p>
@@ -757,7 +757,7 @@
 <pre>
 template &lt;class... UTypes&gt;
   requires Has<ins>Nothrow</ins>Assign&lt;Types, RvalueOf&lt;UTypes&gt;::type&gt;...
- tuple&amp; operator=(tuple&lt;UTypes...&gt;&amp;&amp;);
+ <ins>noexcept</ins> tuple&amp; operator=(tuple&lt;UTypes...&gt;&amp;&amp;);
 </pre>
 
 <h5>23.3.2 Class template deque [deque]</h5>
@@ -765,13 +765,33 @@
 
 <pre>
 requires <ins>Nothrow</ins>AllocatableElement&lt;Alloc, T, T&amp;&amp;&gt; <ins>&amp;&amp; NothrowMoveConstructible&lt;Alloc&gt;</ins>
- deque(deque&amp;&amp;);
+ <ins>noexcept</ins> deque(deque&amp;&amp;);
 requires <ins>Nothrow</ins>AllocatableElement&lt;Alloc, T, T&amp;&amp;&gt; <ins>&amp;&amp; NothrowConstructible&lt;Alloc, const Alloc&amp;&gt;</ins>
- deque(deque&amp;&amp;, const Alloc&amp;);
+ <ins>noexcept</ins> deque(deque&amp;&amp;, const Alloc&amp;);
 </pre>
 
+<p>Modify the <code>deque</code> move assignment operator as follows:</p>
+
+<pre>
+requires <ins>Nothrow</ins>AllocatableElement&lt;Alloc, T, T&amp;&amp;&gt; &amp;&amp; MoveAssignable&lt;T&gt;
+ <ins>&amp;&amp; NothrowMoveAssignable&lt;Alloc&gt;</ins>
+ <ins>noexcept</ins> deque&lt;T,Alloc&gt;&amp; operator=(deque&lt;T,Alloc&gt;&amp;&amp; x);
+</pre>
+
+<p>Each of the other standard containers and container adaptors will require similar modifications.</p>
+
 <h4 id="noexcept-annot"><code>noexcept</code> Annotations</h4>
 
+<p>Since a <code>noexcept</code> function can only call into other <code>noexcept</code> functions, much of the standard library itself will require <code>noexcept</code> annotations to make those parts of the library usable. Therefore, for any function that is currently specified as <code>throw()</code> we propose to replace the <code>throw()</code> with a <code>noexcept</code> specifier. Additionally, for any operation with a clause</p>
+
+<ul>
+ <li><i>Throws</i>: nothing</li>
+</ul>
+
+<p>we propose to remove this clause and instead introduce the <code>noexcept</code> specifier on the corresponding declaration.</p>
+
+<p>These changes are likely to effect a significant portion of the Standard Library, including nearly all of the C standard library. In most cases, the changes merely enforce requirements that have already been present in the library.</p>
+
 <h2 id="syntax">Alternative Syntax</h2>
 
 <p>We have considered several alternative syntaxes for <code>noexcept</code>, and we catalog the most promising alternatives here:</p>
@@ -791,5 +811,5 @@
 
 <hr>
 <address></address>
-<!-- hhmts start --> Last modified: Sun Mar 22 22:06:29 PDT 2009 <!-- hhmts end -->
+<!-- hhmts start --> Last modified: Sun Mar 22 22:27:11 PDT 2009 <!-- hhmts end -->
 </body> </html>


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