Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50149 - sandbox/committee/rvalue_ref
From: dave_at_[hidden]
Date: 2008-12-05 22:50:59


Author: dave
Date: 2008-12-05 22:50:58 EST (Fri, 05 Dec 2008)
New Revision: 50149
URL: http://svn.boost.org/trac/boost/changeset/50149

Log:
Fix up some blunders, lots left to do

Text files modified:
   sandbox/committee/rvalue_ref/n2812_08-0322_soundness.rst | 19 ++++++++++++-------
   1 files changed, 12 insertions(+), 7 deletions(-)

Modified: sandbox/committee/rvalue_ref/n2812_08-0322_soundness.rst
==============================================================================
--- sandbox/committee/rvalue_ref/n2812_08-0322_soundness.rst (original)
+++ sandbox/committee/rvalue_ref/n2812_08-0322_soundness.rst 2008-12-05 22:50:58 EST (Fri, 05 Dec 2008)
@@ -125,7 +125,7 @@
 takes its second parameter by rvalue reference::
 
   template <class T>
- void assign(queue<Cont>& dest, std::vector<T>&& src); // #2: move from src into dest
+ void assign(queue<T>& dest, std::vector<T>&& src); // #2: move from src into dest
 
 This idiom relies on the presence of *both* overloads. Overload #2
 makes it move, but overload #1 makes it safe. Without overload
@@ -139,16 +139,16 @@
 std::vector<int> does: rvalue arguments, which can be safely moved from, select
 overload #2::
 
- queue<move_only_container> q2;
- assign(q2, move_only_container());
+ queue<move_only_type> q2;
+ assign(q2, vector<move_only_type>());
 
 As before, lvalue arguments select overload #1::
 
- move_only_container y;
+ vector<move_only_type> y;
   assign(q2, y);
 
 However, since the argument type is noncopyable, the body of #1 fails
-compilation when it attempts to make a copy.
+compilation (as desired) when it attempts to make a copy.
 
 The Problem
 ===========
@@ -169,10 +169,15 @@
 copied. We might modify overload #1 as follows::
 
   // #1 with optional allocator
- template <class Cont>
- void assign(queue<Cont>& dest, Cont const& src,
+ template <class T>
+ void assign(queue<T>& dest, Cont const& src,
               typename Cont::allocator_type = typename Cont::allocator_type());
 
+
+.. Warning:: The **above is still wrong** because of the deduction
+ rule!! The rest of the document **still needs to be fixed** so
+ that we're not using a bare ``Cont`` argument!!
+
 For all container types that provide a suitable nested allocator_type,
 all is well. However, if the container type does not provide a nested
 allocator_type, SFINAE eliminates overload #1, causing overload #2 to


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