stdpain opened a new issue #5855:
URL: https://github.com/apache/incubator-doris/issues/5855


   **Describe the bug**
   eg:
   ```
   #include <algorithm>
   #include <iostream>
   #include <map>
   
   struct MC {
       MC() = default;
       MC(const MC& r) { std::cout << "call copy construct" << std::endl; }
       size_t write(char*) const { return 0; }
       int ans;
   };
   
   int main() {
       MC mc0;
       std::map<int, MC> st;
       using iter = std::map<int, MC>::iterator;
       st[0] = mc0;
       st[1] = mc0;
       std::cout << "start test" << std::endl;
       char mem_buffer[4096];
       char* buf = mem_buffer;
       std::for_each(st.cbegin(), st.cend(), [&buf](const std::pair<const int, 
MC>& map_entry) {
           buf += map_entry.second.write(buf);
       });
       std::cout << "start test 2" << std::endl;
       std::for_each(st.cbegin(), st.cend(), [&buf](const std::pair<int, MC>& 
map_entry) {
           buf += map_entry.second.write(buf);
       });
   
       return 0;
   }
   ```
   
   output:
   ```
   start test
   start test 2
   call copy construct
   call copy construct
   ```
   
   so we should make `std::pair<uint32_t,RoarMap>` to  `std::pair<const 
uint32_t,RoarMap>`
   


-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to