|
Boost-Commit : |
From: nielsdekker_at_[hidden]
Date: 2008-08-28 14:37:45
Author: niels_dekker
Date: 2008-08-28 14:37:45 EDT (Thu, 28 Aug 2008)
New Revision: 48424
URL: http://svn.boost.org/trac/boost/changeset/48424
Log:
Added value_initialized::swap according to ticket #2243, as agreed with Fernando Cacciola :-)
Text files modified:
trunk/boost/utility/value_init.hpp | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
Modified: trunk/boost/utility/value_init.hpp
==============================================================================
--- trunk/boost/utility/value_init.hpp (original)
+++ trunk/boost/utility/value_init.hpp 2008-08-28 14:37:45 EDT (Thu, 28 Aug 2008)
@@ -7,6 +7,7 @@
// 21 Ago 2002 (Created) Fernando Cacciola
// 24 Dec 2007 (Refactored and worked around various compiler bugs) Fernando Cacciola, Niels Dekker
// 23 May 2008 (Fixed operator= const issue, added initialized_value) Niels Dekker, Fernando Cacciola
+// 21 Ago 2008 (Added swap) Niels Dekker, Fernando Cacciola
//
#ifndef BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
#define BOOST_UTILITY_VALUE_INIT_21AGO2002_HPP
@@ -22,6 +23,7 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits/cv_traits.hpp>
#include <boost/type_traits/alignment_of.hpp>
+#include <boost/swap.hpp>
#include <cstring>
#include <new>
@@ -93,6 +95,11 @@
return wrapper_address()->data;
}
+ void swap(value_initialized & arg)
+ {
+ ::boost::swap( this->data(), arg.data() );
+ }
+
operator T&() const { return this->data(); }
} ;
@@ -110,6 +117,12 @@
return x.data() ;
}
+template<class T>
+void swap ( value_initialized<T> & lhs, value_initialized<T> & rhs )
+{
+ lhs.swap(rhs) ;
+}
+
class initialized_value_t
{
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