|
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<typename T, typename... Args>
- : Constructible<T, Args...> {
- noexcept T::T(Args...);
-}
-
-auto concept NothrowMoveConstructible<typename T> : MoveConstructible<T> {
- requires RvalueOf<T>
- && NothrowConstructible<T, RvalueOf<T>::type>;
-}
-
-auto concept HasNothrowAssign<typename T, typename U> : HasAssign<T, U> {
- noexcept result_type T::operator=(U);
-}
+<ins>auto concept NothrowConstructible<typename T, typename... Args>
+<ins> : Constructible<T, Args...> {</ins>
+<ins> noexcept T::T(Args...);</ins>
+<ins>}</ins>
+
+<ins>auto concept NothrowMoveConstructible<typename T> : MoveConstructible<T> {</ins>
+<ins> requires RvalueOf<T></ins>
+<ins> && NothrowConstructible<T, RvalueOf<T>::type>;</ins>
+<ins>}</ins>
+
+<ins>auto concept HasNothrowAssign<typename T, typename U> : HasAssign<T, U> {</ins>
+<ins> noexcept result_type T::operator=(U);</ins>
+<ins>}</ins>
-auto concept NothrowMoveAssignable<typename T> : MoveAssignable<T>, HasNothrowAssign<T, T&&> { }
+<ins>auto concept NothrowMoveAssignable<typename T> : MoveAssignable<T>, HasNothrowAssign<T, T&&> { }</ins>
</pre>
<p>In addition, we need <code>Nothrow</code> variants of the concepts used for scoped allocators:</p>
<pre>
-concept NothrowConstructibleWithAllocator<class T, class Alloc, class... Args> {
- noexcept T::T(allocator_arg_t, Alloc, Args&&...);
-}
-
-auto concept NothrowAllocatableElement<class Alloc, class T, class... Args> : AllocatableElement<Alloc, T, Args...> {
- noexcept void Alloc::construct(T*, Args&&...);
-}
+<ins>concept NothrowConstructibleWithAllocator<class T, class Alloc, class... Args> {</ins>
+<ins> noexcept T::T(allocator_arg_t, Alloc, Args&&...);</ins>
+<ins>}</ins>
+
+<ins>auto concept NothrowAllocatableElement<class Alloc, class T, class... <ins>Args> : AllocatableElement<Alloc, T, Args...> {</ins>
+<ins> noexcept void Alloc::construct(T*, Args&&...);</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<typename T> : HasDestructor<T> {
- noexcept T::~T();
+ <ins>noexcept T::~T();</ins>
}
</pre>
@@ -723,19 +723,19 @@
<pre>
template<class U, class V>
requires <ins>Nothrow</ins>Constructible<T1, RvalueOf<U>::type> && <ins>Nothrow</ins>Constructible<T2, RvalueOf<V>::type>
- pair(pair<U, V>&& p);
+ <ins>noexcept</ins> pair(pair<U, V>&& p);
template<class U, class V, Allocator Alloc>
requires <ins>Nothrow</ins>ConstructibleWithAllocator<T1, Alloc, RvalueOf<U>::type>
&& <ins>Nothrow</ins>ConstructibleWithAllocator<T2, Alloc, RvalueOf<V>::type>
- pair(allocator_arg_t, const Alloc& a, pair<U, V>&& p);
+ <ins>noexcept</ins> pair(allocator_arg_t, const Alloc& a, pair<U, V>&& p);
</pre>
<p>Similarly, <code>pair</code>'s move assignment operator will be modified as follows:</p>
<pre>
template<class U , class V>
requires Has<ins>Nothrow</ins>Assign<T1, RvalueOf<U>::type> && Has<ins>Nothrow</ins>Assign<T2, RvalueOf<V>::type>
- pair& operator=(pair<U , V>&& p);
+ <ins>noexcept</ins> pair& operator=(pair<U , V>&& p);
</pre>
<h5>20.5.2 Class template tuple [tuple.tuple]</h5>
@@ -745,11 +745,11 @@
<pre>
template <class... UTypes>
requires <ins>Nothrow</ins>Constructible<Types, RvalueOf<UTypes>::type>...
- tuple(tuple<UTypes...>&&);
+ <ins>noexcept</ins> tuple(tuple<UTypes...>&&);
template <Allocator Alloc, class... UTypes>
requires <ins>Nothrow</ins>ConstructibleWithAllocator<Types, Alloc, RvalueOf<UTypes>::type>...
- tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
+ <ins>noexcept</ins> tuple(allocator_arg_t, const Alloc& a, tuple<UTypes...>&&);
</pre>
<p><code>tuple</code>'s move assignment operator will be modified as follows:</p>
@@ -757,7 +757,7 @@
<pre>
template <class... UTypes>
requires Has<ins>Nothrow</ins>Assign<Types, RvalueOf<UTypes>::type>...
- tuple& operator=(tuple<UTypes...>&&);
+ <ins>noexcept</ins> tuple& operator=(tuple<UTypes...>&&);
</pre>
<h5>23.3.2 Class template deque [deque]</h5>
@@ -765,13 +765,33 @@
<pre>
requires <ins>Nothrow</ins>AllocatableElement<Alloc, T, T&&> <ins>&& NothrowMoveConstructible<Alloc></ins>
- deque(deque&&);
+ <ins>noexcept</ins> deque(deque&&);
requires <ins>Nothrow</ins>AllocatableElement<Alloc, T, T&&> <ins>&& NothrowConstructible<Alloc, const Alloc&></ins>
- deque(deque&&, const Alloc&);
+ <ins>noexcept</ins> deque(deque&&, const Alloc&);
</pre>
+<p>Modify the <code>deque</code> move assignment operator as follows:</p>
+
+<pre>
+requires <ins>Nothrow</ins>AllocatableElement<Alloc, T, T&&> && MoveAssignable<T>
+ <ins>&& NothrowMoveAssignable<Alloc></ins>
+ <ins>noexcept</ins> deque<T,Alloc>& operator=(deque<T,Alloc>&& 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