Boost logo

Boost-Commit :

From: troy_at_[hidden]
Date: 2008-06-29 11:48:55


Author: troy
Date: 2008-06-29 11:48:54 EDT (Sun, 29 Jun 2008)
New Revision: 46863
URL: http://svn.boost.org/trac/boost/changeset/46863

Log:
merge from release branch
Text files modified:
   branches/CMake/release/libs/algorithm/string/doc/concept.xml | 2 +-
   branches/CMake/release/libs/algorithm/string/example/rle_example.cpp | 29 ++++++++++++++++++-----------
   branches/CMake/release/libs/algorithm/string/test/predicate_test.cpp | 8 ++++++++
   branches/CMake/release/libs/algorithm/string/test/replace_test.cpp | 1 +
   4 files changed, 28 insertions(+), 12 deletions(-)

Modified: branches/CMake/release/libs/algorithm/string/doc/concept.xml
==============================================================================
--- branches/CMake/release/libs/algorithm/string/doc/concept.xml (original)
+++ branches/CMake/release/libs/algorithm/string/doc/concept.xml 2008-06-29 11:48:54 EDT (Sun, 29 Jun 2008)
@@ -102,7 +102,7 @@
 struct simple_finder
 {
     template<typename ForwardIteratorT>
- boost::iterator_range<ForwardIterator> operator()(
+ boost::iterator_range<ForwardIteratorT> operator()(
         ForwardIteratorT Begin,
         ForwardIteratorT End )
     {

Modified: branches/CMake/release/libs/algorithm/string/example/rle_example.cpp
==============================================================================
--- branches/CMake/release/libs/algorithm/string/example/rle_example.cpp (original)
+++ branches/CMake/release/libs/algorithm/string/example/rle_example.cpp 2008-06-29 11:48:54 EDT (Sun, 29 Jun 2008)
@@ -114,10 +114,13 @@
     result_type operator()( const ReplaceT& Replace ) const
     {
         SeqT r;
- r.push_back( repeat_mark<value_type>() );
- r.push_back( *(Replace.begin()) );
- r.push_back( value_type( Replace.size() ) );
-
+ if(!Replace.empty())
+ {
+ r.push_back( repeat_mark<value_type>() );
+ r.push_back( *(Replace.begin()) );
+ r.push_back( value_type( Replace.size() ) );
+ }
+
         return r;
     }
 };
@@ -183,14 +186,18 @@
     template< typename ReplaceT >
     result_type operator()( const ReplaceT& Replace ) const
     {
- // extract info
- typename ReplaceT::const_iterator It=Replace.begin();
-
- value_type Value=*(++It);
- value_type Repeat=*(++It);
-
         SeqT r;
- for( value_type Index=0; Index<Repeat; Index++ ) r.push_back( Value );
+
+ if(!Replace.empty())
+ {
+ // extract info
+ typename ReplaceT::const_iterator It=Replace.begin();
+
+ value_type Value=*(++It);
+ value_type Repeat=*(++It);
+
+ for( value_type Index=0; Index<Repeat; Index++ ) r.push_back( Value );
+ }
 
         return r;
     }

Modified: branches/CMake/release/libs/algorithm/string/test/predicate_test.cpp
==============================================================================
--- branches/CMake/release/libs/algorithm/string/test/predicate_test.cpp (original)
+++ branches/CMake/release/libs/algorithm/string/test/predicate_test.cpp 2008-06-29 11:48:54 EDT (Sun, 29 Jun 2008)
@@ -121,6 +121,14 @@
 
     TEST_CLASS( !is_classified(std::ctype_base::space), "...", "..\n\r\t " );
     TEST_CLASS( ( !is_any_of("abc") && is_from_range('a','e') ) || is_space(), "d e", "abcde" );
+
+ // is_any_of test
+// TEST_CLASS( !is_any_of(""), "", "aaa" )
+ TEST_CLASS( is_any_of("a"), "a", "ab" )
+ TEST_CLASS( is_any_of("ba"), "ab", "abc" )
+ TEST_CLASS( is_any_of("cba"), "abc", "abcd" )
+ TEST_CLASS( is_any_of("hgfedcba"), "abcdefgh", "abcdefghi" )
+ TEST_CLASS( is_any_of("qponmlkjihgfedcba"), "abcdefghijklmnopq", "zzz" )
 }
 
 #undef TEST_CLASS

Modified: branches/CMake/release/libs/algorithm/string/test/replace_test.cpp
==============================================================================
--- branches/CMake/release/libs/algorithm/string/test/replace_test.cpp (original)
+++ branches/CMake/release/libs/algorithm/string/test/replace_test.cpp 2008-06-29 11:48:54 EDT (Sun, 29 Jun 2008)
@@ -120,6 +120,7 @@
 {
     // replace all
     TEST_ALGO( replace_all, "1abc3abc2", string("abc") C_ string("YYY"), string("1YYY3YYY2") );
+ TEST_ALGO( replace_all, string("1abc3abc2"), "/" C_ "\\", string("1abc3abc2") );
     TEST_ALGO( ireplace_all, "1aBc3AbC2", "abC" C_ "YYY", string("1YYY3YYY2") );
     TEST_ALGO( replace_all, "1abc3abc2", string("abc") C_ string("Z"), string("1Z3Z2") );
     TEST_ALGO( replace_all, "1abc3abc2", string("abc") C_ string("XXXX"), string("1XXXX3XXXX2") );


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