|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-07-13 15:26:47
Author: danieljames
Date: 2008-07-13 15:26:47 EDT (Sun, 13 Jul 2008)
New Revision: 47398
URL: http://svn.boost.org/trac/boost/changeset/47398
Log:
Support 'auto_ptr'.
Text files modified:
sandbox/move/boost/move.hpp | 36 ++++++++++++++++++++++++++++++++----
sandbox/move/libs/move/test/Jamfile.v2 | 1 +
2 files changed, 33 insertions(+), 4 deletions(-)
Modified: sandbox/move/boost/move.hpp
==============================================================================
--- sandbox/move/boost/move.hpp (original)
+++ sandbox/move/boost/move.hpp 2008-07-13 15:26:47 EDT (Sun, 13 Jul 2008)
@@ -171,12 +171,13 @@
/*************************************************************************************************/
struct copy_tag {};
-struct move_tag {};
struct swap_tag {};
+struct boost_move_tag {};
+struct custom_move_tag {};
template <typename T, class Enable = void>
struct move_type :
- boost::mpl::if_<is_boost_movable<T>, move_tag,
+ boost::mpl::if_<is_boost_movable<T>, boost_move_tag,
typename boost::mpl::if_<boost::detail::has_swap_overload<T>,
swap_tag, copy_tag>::type > {};
@@ -270,7 +271,7 @@
*/
template <typename T>
-T move(T& x, typename move_type_sink<move_tag, T>::type = 0) { return T(move_from<T>(x)); }
+T move(T& x, typename move_type_sink<boost_move_tag, T>::type = 0) { return T(move_from<T>(x)); }
/*************************************************************************************************/
@@ -422,7 +423,7 @@
*/
template <typename T> // T models Regular
-inline void move_construct(T* p, T& x, typename move_type_sink<move_tag, T>::type = 0)
+inline void move_construct(T* p, T& x, typename move_type_sink<boost_move_tag, T>::type = 0)
{
::new(static_cast<void*>(p)) T(move_from<T>(x));
}
@@ -510,6 +511,33 @@
/*************************************************************************************************/
+// auto_ptr support
+
+// Illegal forward declare.
+
+namespace std
+{
+ template <class T> class auto_ptr;
+}
+
+namespace boost
+{
+ template <class T>
+ struct move_type<std::auto_ptr<T>, void> {
+ typedef custom_move_tag type;
+ };
+
+ template <class T>
+ std::auto_ptr<T>& move(std::auto_ptr<T>& x) {
+ return x;
+ }
+
+ template <class T>
+ inline void move_construct(std::auto_ptr<T>* p, std::auto_ptr<T>& x) {
+ ::new(static_cast<void*>(p)) std::auto_ptr<T>(x);
+ }
+}
+
#endif
/*************************************************************************************************/
Modified: sandbox/move/libs/move/test/Jamfile.v2
==============================================================================
--- sandbox/move/libs/move/test/Jamfile.v2 (original)
+++ sandbox/move/libs/move/test/Jamfile.v2 2008-07-13 15:26:47 EDT (Sun, 13 Jul 2008)
@@ -13,6 +13,7 @@
[ run move.cpp ]
[ run noncopyable.cpp ]
[ run swappable.cpp ]
+ [ run auto_ptr.cpp ]
[ run move_test.cpp ]
[ run no_sfinae_test.cpp ]
[ run has_swap_overload.cpp ]
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