|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51923 - sandbox/committee/rvalue_ref
From: dgregor_at_[hidden]
Date: 2009-03-22 23:22:05
Author: dgregor
Date: 2009-03-22 23:22:04 EDT (Sun, 22 Mar 2009)
New Revision: 51923
URL: http://svn.boost.org/trac/boost/changeset/51923
Log:
Some more library schtuff
Text files modified:
sandbox/committee/rvalue_ref/rvalue-ref-exception-safety.html | 103 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 100 insertions(+), 3 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-22 23:22:04 EDT (Sun, 22 Mar 2009)
@@ -1,6 +1,29 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Rvalue References and Exception Safety</title>
+<style type="text/css">
+p {text-align:justify}
+li {text-align:justify}
+ins {background-color:#A0FFA0}
+del {background-color:#FFA0A0}
+
+div.admonition {
+ margin: 2em ;
+ border: medium outset ;
+ padding: 1em }
+
+div.admonition p.admonition-title, {
+ font-weight: bold ;
+ font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+ color: red ;
+ font-weight: bold ;
+ font-family: sans-serif }
+
+</style>
</head>
<body>
@@ -235,7 +258,7 @@
way to recover the vector's original state, since any attempt to move
the previously-moved elements back into the vector's storage could
also throw. Hence, the best we can do is maintain the basic
-guarantee, where no resources are leaked but the first four values in
+guarantee, where no resources are leaked but the first four elements in
the vector have indeterminate values.</p>
<h3 id="strong-except-model">A Model of Strong Exception Safety</h3>
@@ -554,10 +577,84 @@
<p>We propose the introduction of new concepts for non-throwing assignment and construction:</p>
<pre>
-FIXME: start here
+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);
+}
+
+auto concept NothrowMoveAssignable<typename T> : MoveAssignable<T>, HasNothrowAssign<T, T&&> { }
+
+concept NothrowConstructibleWithAllocator<class T, class Alloc, class... Args> {
+ noexcept T::T(allocator_arg_t, Alloc, Args&&...);
+}
</pre>
<h4 id="aggregate">Move Constructors and Move Assignment Operators</h4>
+
+<p>Throughout the library, each class template that aggregates other templates and has a move constructor will need to have its move constructor and move assignment operator be specified as <code>noexcept</code> and only be provided when the operations they use are known to be <code>noexcept</code>. We summarize the changes here, but have omitted the changes for some library components pending a full review of the library.<p>
+
+<h5>20.3.3 Pairs [pairs]</h5>
+
+<p>Two of <code>pair</code>'s move constructors will be modified as follows:</p>
+<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);
+
+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);
+</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);
+</pre>
+
+<h5>20.5.2 Class template tuple [tuple.tuple]</h5>
+
+<p>Two of <code>tuple</code>'s move constructors will be modified as follows:</p>
+
+<pre>
+template <class... UTypes>
+ requires <ins>Nothrow</ins>Constructible<Types, RvalueOf<UTypes>::type>...
+ 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...>&&);
+</pre>
+
+<p><code>tuple</code>'s move assignment operator will be modified as follows:</p>
+
+<pre>
+template <class... UTypes>
+ requires Has<ins>Nothrow</ins>Assign<Types, RvalueOf<UTypes>::type>...
+ tuple& operator=(tuple<UTypes...>&&);
+</pre>
+
+<h5>23.3.2 Class template deque [deque]</h5>
+<p>Modify two of <code>deque</code>'s constructors as follows:</p>
+
+<pre>
+requires <ins>Nothrow</ins>AllocatableElement<Alloc, T, T&&> <ins>&& NothrowMoveConstructible<Alloc></ins>
+ deque(deque&&);
+requires <ins>Nothrow</ins>AllocatableElement<Alloc, T, T&&> <ins>&& NothrowConstructible<Alloc, const Alloc&></ins>
+ deque(deque&&, const Alloc&);
+</pre>
+
<h4 id="noexcept-annot"><code>noexcept</code> Annotations</h4>
<h2 id="alternatives">Alternative Solutions</h2>
@@ -567,5 +664,5 @@
<hr>
<address></address>
-<!-- hhmts start --> Last modified: Sun Mar 22 19:41:21 PDT 2009 <!-- hhmts end -->
+<!-- hhmts start --> Last modified: Sun Mar 22 20:22:03 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