Is a std::vector threadsafe if the threads read and write in disjoint index ranges?
<p>Suppose, I have a <code>std::vector&lt;int&gt;</code> of length 4, which is constant. Then there are 4 threads, where thread <code>i</code> reads and writes only index <code>i</code>. Is this threadsafe? Can the single elements be changed independently of each other? I wonder because they are close so that they are probably loaded all at once into a cacheline.</p>

<p>Does it make a difference if the index range per thread is larger than 1?</p>

<p>EDIT:</p>

<p>I am using Visual Studio 2010 and hence C++03. Any hints about differences from C++03 to C++11 are welcome!</p>