lingbin commented on a change in pull request #2277: Replace boost::split() 
with strings::Split() in options
URL: https://github.com/apache/incubator-doris/pull/2277#discussion_r349927979
 
 

 ##########
 File path: be/src/olap/options.cpp
 ##########
 @@ -17,26 +17,35 @@
 
 #include "olap/options.h"
 
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/classification.hpp>
-#include <boost/algorithm/string/split.hpp>
+#include <algorithm>
 
 #include "common/logging.h"
-
 #include "olap/utils.h"
 
+#include "gutil/strings/split.h"
+
 namespace doris {
 
+static std::string CAPACITY_UC = "CAPACITY";
+static std::string MEDIUM_UC = "MEDIUM";
+static std::string SSD_UC = "SSD";
+static std::string HDD_UC = "HDD";
+
+// TODO: should be a general util method
+std::string to_upper(const std::string& str) {
+    std::string out = str;
+    std::transform(out.begin(), out.end(), out.begin(), ::toupper);
 
 Review comment:
   I am not sure if I get what you mean, Is it the following way?
   ```
   std::string out;
   out.resize(str.size());
   for (int i = 0; i < str.size(); ++i) {
       out[i] = ::toupper(str[i]);
   }
   return out;
   ```
   
   I am not to be overly pedantic, but it still will iterate twice.
   
   The first one is in `std::string::resize()`, all the character will be set 
to '\0'(i.e. it need a `memset()`), like the Ctor `std::string(const string& 
str)`(it need a `memcpy()`)
   
   And, the above implementation may have a side effect: it may dynamically 
apply for memory twice.
   - The first time in the std::string's `default ctor`, apply for a default 
capacity;
   - The second time is in `resize()` if the required length is greater than 
the default capacity

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to