Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52763 - in sandbox/boost0x: boost/filesystem libs/filesystem/test
From: kim_at_[hidden]
Date: 2009-05-04 20:00:36


Author: kimscheibel
Date: 2009-05-04 20:00:35 EDT (Mon, 04 May 2009)
New Revision: 52763
URL: http://svn.boost.org/trac/boost/changeset/52763

Log:
proof of concept move ctor of boost:filesystem:path
Text files modified:
   sandbox/boost0x/boost/filesystem/path.hpp | 3 +++
   sandbox/boost0x/libs/filesystem/test/path_test.cpp | 4 ++++
   2 files changed, 7 insertions(+), 0 deletions(-)

Modified: sandbox/boost0x/boost/filesystem/path.hpp
==============================================================================
--- sandbox/boost0x/boost/filesystem/path.hpp (original)
+++ sandbox/boost0x/boost/filesystem/path.hpp 2009-05-04 20:00:35 EDT (Mon, 04 May 2009)
@@ -30,6 +30,7 @@
 #include <iosfwd> // needed by basic_path inserter and extractor
 #include <stdexcept>
 #include <cassert>
+#include <iostream>
 
 # ifndef BOOST_FILESYSTEM_NARROW_ONLY
 # include <locale>
@@ -163,6 +164,8 @@
 
       // constructors/destructor
       basic_path() {}
+ basic_path( const path_type & p ) : m_path(p.m_path) {}
+ basic_path( path_type && p ) { m_path.clear(); m_path.swap(p.m_path); std::cout << "moving\n"; } // TODO: which swap()
       basic_path( const string_type & s ) { operator/=( s ); }
       basic_path( const value_type * s ) { operator/=( s ); }
 # ifndef BOOST_NO_MEMBER_TEMPLATES

Modified: sandbox/boost0x/libs/filesystem/test/path_test.cpp
==============================================================================
--- sandbox/boost0x/libs/filesystem/test/path_test.cpp (original)
+++ sandbox/boost0x/libs/filesystem/test/path_test.cpp 2009-05-04 20:00:35 EDT (Mon, 04 May 2009)
@@ -202,6 +202,10 @@
 
   path p1( "fe/fi/fo/fum" );
   path p2( p1 );
+
+ path p1_move( "fe/fi/fo/fum" );
+ path p2_move( std::move(p1_move) );
+
   path p3;
   BOOST_TEST( p1.string() != p3.string() );
 


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