|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55210 - sandbox/fmhess/boost/generic_ptr
From: fmhess_at_[hidden]
Date: 2009-07-30 14:43:34
Author: fmhess
Date: 2009-07-27 16:37:57 EDT (Mon, 27 Jul 2009)
New Revision: 55210
URL: http://svn.boost.org/trac/boost/changeset/55210
Log:
Use boost::swap, and add explicit std::move() call
when moving wrapped generic pointers.
Text files modified:
sandbox/fmhess/boost/generic_ptr/shared.hpp | 8 ++++----
sandbox/fmhess/boost/generic_ptr/weak.hpp | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
Modified: sandbox/fmhess/boost/generic_ptr/shared.hpp
==============================================================================
--- sandbox/fmhess/boost/generic_ptr/shared.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/shared.hpp 2009-07-27 16:37:57 EDT (Mon, 27 Jul 2009)
@@ -48,13 +48,13 @@
#include <boost/smart_ptr/detail/sp_convertible.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/utility/enable_if.hpp>
+#include <boost/utility/swap.hpp>
#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
#include <boost/smart_ptr/detail/spinlock_pool.hpp>
#include <boost/memory_order.hpp>
#endif
-#include <algorithm> // for std::swap
#include <functional> // for std::less
#include <typeinfo> // for std::bad_cast
@@ -332,7 +332,7 @@
#ifndef BOOST_NO_RVALUE_REFERENCES
- shared( shared && r ): px( r.px ), pn() // never throws
+ shared( shared && r ): px( std::move(r.px) ), pn() // never throws
{
pn.swap( r.pn );
detail::set_plain_old_pointer_to_null(r.px);
@@ -348,7 +348,7 @@
shared( shared<Y> && r )
#endif
- : px( r.px ), pn() // never throws
+ : px( std::move(r.px) ), pn() // never throws
{
pn.swap( r.pn );
detail::set_plain_old_pointer_to_null(r.px);
@@ -426,7 +426,7 @@
void swap(shared<T> & other) // never throws
{
- std::swap(px, other.px);
+ boost::swap(px, other.px);
pn.swap(other.pn);
}
Modified: sandbox/fmhess/boost/generic_ptr/weak.hpp
==============================================================================
--- sandbox/fmhess/boost/generic_ptr/weak.hpp (original)
+++ sandbox/fmhess/boost/generic_ptr/weak.hpp 2009-07-27 16:37:57 EDT (Mon, 27 Jul 2009)
@@ -17,6 +17,7 @@
#include <memory> // boost.TR1 include order fix
#include <boost/smart_ptr/detail/shared_count.hpp>
#include <boost/generic_ptr/shared.hpp>
+#include <boost/utility/swap.hpp>
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
# pragma warning(push)
@@ -97,7 +98,7 @@
}
// for better efficiency in the T == Y case
- weak( weak && r ): px( r.px ), pn(std::move(r.pn)) // never throws
+ weak( weak && r ): px( std::move(r.px) ), pn(std::move(r.pn)) // never throws
{
detail::set_plain_old_pointer_to_null(r.px);
}
@@ -184,7 +185,7 @@
void swap(this_type & other) // never throws
{
- std::swap(px, other.px);
+ boost::swap(px, other.px);
pn.swap(other.pn);
}
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