About thread safety issues of C++ std::map

Recently, I discussed the issue of thread safety of map containers with my colleagues. We each had different opinions, so I checked the information online and got an answer that everyone agreed with, that is: when the operation of the container is no-const and multi-threaded, it should Lock it up and protect it. Below is the original question and answer seen on stack overflow.

Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_43815862/article/details/133342659