[mlpack-svn] r16089 - mlpack/trunk/src/mlpack/core/util

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Dec 28 23:16:53 EST 2013


Author: rcurtin
Date: Sat Dec 28 23:16:52 2013
New Revision: 16089

Log:
I don't remember doing this, and I have no idea when it was, but hey, using
namespace std in cpp files is a cool idea.


Modified:
   mlpack/trunk/src/mlpack/core/util/string_util.cpp

Modified: mlpack/trunk/src/mlpack/core/util/string_util.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/util/string_util.cpp	(original)
+++ mlpack/trunk/src/mlpack/core/util/string_util.cpp	Sat Dec 28 23:16:52 2013
@@ -7,10 +7,11 @@
 
 using namespace mlpack;
 using namespace mlpack::util;
+using namespace std;
 
 //! A utility function that replaces all all newlines with a number of spaces
 //! depending on the indentation level.
-std::string mlpack::util::Indent(std::string input)
+string mlpack::util::Indent(string input)
 {
   // Tab the first line.
   input.insert(0, 1, ' ');
@@ -20,10 +21,11 @@
   std::string tabbedNewline("\n  ");
 
   // Replace all newline characters with the precomputed character sequence.
-  size_t start_pos = 0;
-  while((start_pos = input.find("\n", start_pos)) != std::string::npos) {
-      input.replace(start_pos, 1, tabbedNewline);
-      start_pos += tabbedNewline.length();
+  size_t startPos = 0;
+  while ((startPos = input.find("\n", startPos)) != string::npos)
+  {
+    input.replace(startPos, 1, tabbedNewline);
+    startPos += tabbedNewline.length();
   }
 
   return input;



More information about the mlpack-svn mailing list