Can multiple threads access a vector at different places?

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-06-01T16:06:29Z Indexed on 2010/06/01 16:13 UTC
Read the original article Hit count: 161

Filed under:
|
|

Lets say I have a vector of int which I've prefilled with 100 elements with a value of 0.

Then I create 2 threads and tell the first thread to fill elements 0 to 49 with numbers, then tell thread 2 to fill elements 50 to 99 with numbers. Can this be done? Otherwise, what's the best way of achieving this?

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about c