I'm working on a multithreaded application that uses a std::map
underneath. I am aware that writing to std::map
is not thread safe and I need to lock the tree when I'm writing.
However, I couldn't find a definition of "writing". Does it only include operations that insert or remove elements from the tree? Or does modifying an element's value in the tree also count as a write?
Consider std::map<int, MyClass> Test
, where MyClass
has a member variable int x
.
Let's say MyClass& t = Test.at(7);
. Is t.x++
then considered a write to the map?