我可以訪問(不鎖定)一個std :: map條目,而另一個線程插入/擦除entrys?從另一個線程插入/擦除時,是否可以訪問C++ 11 std :: map條目?
例如僞C++:
typedef struct {
int value;
int stuff;
}some_type_t;
std::map<char,some_type_t*> my_map;
//thread 1 does:
my_map.at('a')->value = 1;
//thread 2 does:
some_type_t* stuff = my_map.at('b');
//thread 3 does:
my_map.erase('c');
//I'm not modifying any elements T is a pointer to an previously allocated "some_type_t"
STD C++ 11說,所有成員都應該是線程安全的(刪除()不是常量)。
+1表示答案是'否' – Soren 2014-09-25 06:47:32