Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54055 - in trunk: boost/filesystem libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2009-06-18 11:48:20


Author: bemandawes
Date: 2009-06-18 11:48:19 EDT (Thu, 18 Jun 2009)
New Revision: 54055
URL: http://svn.boost.org/trac/boost/changeset/54055

Log:
Filesystem: add basic_path::clear() to fix #3186, clear() missing
Text files modified:
   trunk/boost/filesystem/path.hpp | 9 +++++++++
   trunk/libs/filesystem/test/path_test.cpp | 5 +++++
   2 files changed, 14 insertions(+), 0 deletions(-)

Modified: trunk/boost/filesystem/path.hpp
==============================================================================
--- trunk/boost/filesystem/path.hpp (original)
+++ trunk/boost/filesystem/path.hpp 2009-06-18 11:48:19 EDT (Thu, 18 Jun 2009)
@@ -208,6 +208,15 @@
           basic_path & append( InputIterator first, InputIterator last );
 # endif
       
+ void clear()
+ {
+# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310)
+ m_path.clear();
+# else
+ m_path.erase( m_path.begin(), m_path.end() );
+# endif
+ }
+
       void swap( basic_path & rhs )
       {
         m_path.swap( rhs.m_path );

Modified: trunk/libs/filesystem/test/path_test.cpp
==============================================================================
--- trunk/libs/filesystem/test/path_test.cpp (original)
+++ trunk/libs/filesystem/test/path_test.cpp 2009-06-18 11:48:19 EDT (Thu, 18 Jun 2009)
@@ -299,6 +299,11 @@
   PATH_CHECK( p5, "/" );
 
 # endif
+ path clear_path( "foo" );
+
+ BOOST_TEST( !clear_path.empty() );
+ clear_path.clear();
+ BOOST_TEST( clear_path.empty() );
 
   BOOST_TEST( p1 != p4 );
   BOOST_TEST( p1.string() == p2.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