Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48726 - sandbox/move/boost/move
From: daniel_james_at_[hidden]
Date: 2008-09-11 03:11:10


Author: danieljames
Date: 2008-09-11 03:11:09 EDT (Thu, 11 Sep 2008)
New Revision: 48726
URL: http://svn.boost.org/trac/boost/changeset/48726

Log:
Remove 'swap_from'.

I think I included 'swap_from' so that it could be used to write classes
that used swap for move and also included support for this library. But
in that case the user should just use 'move_from', so it isn't needed.
Text files modified:
   sandbox/move/boost/move/move.hpp | 35 ++++++++---------------------------
   1 files changed, 8 insertions(+), 27 deletions(-)

Modified: sandbox/move/boost/move/move.hpp
==============================================================================
--- sandbox/move/boost/move/move.hpp (original)
+++ sandbox/move/boost/move/move.hpp 2008-09-11 03:11:09 EDT (Thu, 11 Sep 2008)
@@ -117,32 +117,6 @@
 
 /*************************************************************************************************/
 
-/*!
-\ingroup move_related
-\brief swap_from is used for move_ctors.
-*/
-
-template <typename T>
-struct swap_from
-{
- swap_from(T& x)
- : m(x)
- {}
-
- operator T() const
- {
- T x;
- using std::swap;
- swap(this->m, x);
- return x;
- }
-
- T& m;
-};
-
-
-/*************************************************************************************************/
-
 #if !defined(BOOST_MOVE_NO_HAS_MOVE_ASSIGN)
 
 /*************************************************************************************************/
@@ -296,7 +270,14 @@
 \brief This version of move is selected when T is swappable.
 */
 template <typename T>
-T move(T& x, typename move_type_sink<swap_tag, T>::type = 0) { return T(swap_from<T>(x)); }
+T move(T& x, typename move_type_sink<swap_tag, T>::type = 0)
+{
+ T y;
+ using std::swap;
+ swap(x, y);
+ return y;
+}
+
 
 /*************************************************************************************************/
 


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