Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55193 - sandbox/libs/mapreduce/test
From: cdm.henderson_at_[hidden]
Date: 2009-07-30 14:43:05


Author: chenderson
Date: 2009-07-26 17:43:22 EDT (Sun, 26 Jul 2009)
New Revision: 55193
URL: http://svn.boost.org/trac/boost/changeset/55193

Log:
Fixed bug with case-insensitivity
Text files modified:
   sandbox/libs/mapreduce/test/mrtest.cpp | 15 +++++++++++++--
   1 files changed, 13 insertions(+), 2 deletions(-)

Modified: sandbox/libs/mapreduce/test/mrtest.cpp
==============================================================================
--- sandbox/libs/mapreduce/test/mrtest.cpp (original)
+++ sandbox/libs/mapreduce/test/mrtest.cpp 2009-07-26 17:43:22 EDT (Sun, 26 Jul 2009)
@@ -86,7 +86,12 @@
         {
             if ((ch < 'A' || ch > 'Z') && ch != '\'')
             {
- runtime.emit_intermediate(std::string(word,ptr-word), 1);
+ std::string w(word,ptr-word);
+ std::transform(w.begin(), w.end(), w.begin(),
+ std::bind1st(
+ std::mem_fun(&std::ctype<char>::tolower),
+ &std::use_facet<std::ctype<char> >(std::locale::classic())));
+ runtime.emit_intermediate(w, 1);
                 in_word = false;
             }
         }
@@ -102,7 +107,12 @@
     if (in_word)
     {
         BOOST_ASSERT(ptr-word > 0);
- runtime.emit_intermediate(std::string(word,ptr-word), 1);
+ std::string w(word,ptr-word);
+ std::transform(w.begin(), w.end(), w.begin(),
+ std::bind1st(
+ std::mem_fun(&std::ctype<char>::tolower),
+ &std::use_facet<std::ctype<char> >(std::locale::classic())));
+ runtime.emit_intermediate(w, 1);
     }
 }
 
@@ -227,6 +237,7 @@
         std::cout << "\nRunning Sequential MapReduce...";
 
         spec.map_tasks = 1;
+ spec.reduce_tasks = 1;
 
         wordcount::job job(datasource, spec);
         job.run<boost::mapreduce::schedule_policy::sequential<wordcount::job> >(result);


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