I\'ve read on Stackoverflow that none of the STL containers are thread-safe for writing. But what does that mean in practice? Does it mean I should store writab
In this case you should just construct your vector with necessary number of values? and all will work fine.
std::vector data(n, 0);
resize()
works well to. The performance will be equal.
The reason why multithread access will not corrupt the vector is: your data is located at its place and will not move from there. OMP threads will not access to the same element at a time.