Github user xunzhang commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/721#discussion_r67278260
  
    --- Diff: src/test/feature/lib/file_replace.cpp ---
    @@ -0,0 +1,56 @@
    +#include <iostream>
    +#include <fstream>
    +
    +#include "file_replace.h"
    +
    +using std::string;
    +using std::map;
    +using std::endl;
    +using std::ifstream;
    +using std::ofstream;
    +
    +namespace hawq {
    +namespace test {
    +
    +string FileReplace::replaceAllOccurrences(
    +   string str,
    +   const string& src,
    +   const string& dst)
    +{
    +   size_t start_pos = 0;
    +   while ((start_pos = str.find(src, start_pos)) != string::npos)
    +   {
    +           str.replace(start_pos, src.length(), dst);
    +           start_pos += dst.length();
    +   }
    +
    +   return str;
    +}
    +
    +void FileReplace::replace(
    +   const string& file_src,
    +   const string& file_dst,
    +   const map<string, string>& strs_src_dst)
    --- End diff --
    
    `std::map` is implemented with red-black tree which not truly hashmap, 
using `std::unordered_map` instead?
    `#include <unordered_map>`
    `std::unordered_map<string, string> dict;`
    `dict["hello"] = "world";`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to