Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55179 - sandbox/libs/mapreduce/examples/wordcount
From: cdm.henderson_at_[hidden]
Date: 2009-07-30 14:42:33


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

Log:
Fixed bug with case-insensitivity
Text files modified:
   sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp | 14 ++++++++++++--
   1 files changed, 12 insertions(+), 2 deletions(-)

Modified: sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp
==============================================================================
--- sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp (original)
+++ sandbox/libs/mapreduce/examples/wordcount/wordcount.cpp 2009-07-26 12:57:43 EDT (Sun, 26 Jul 2009)
@@ -48,7 +48,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;
                 }
             }
@@ -64,7 +69,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);
         }
     }
 };


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