多线程访问是否需要同步
pair<iterator,iterator> equal_range (const value_type& val) const;
由于 equal_range
是读取操作,因此可能不需要。请给出意见。
最佳答案
正如您所说,因为您只是在“读取数据”,所以您不需要任何同步,您可以期望该函数是“线程安全的”,参见 question接受的答案指出:
[17.6.5.9/3] A C++ standard library function shall not directly or indirectly modify objects (1.10) accessible by threads other than the current thread unless the objects are accessed directly or indirectly via the function’s non-const arguments, including this.
关于c++ - multiset equal_range 线程安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24217616/