Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

When to use tbb::concurrent_vector ?

roderickHuang
Beginner
251 Views

Dear all,

 

I'm newbe of Intel TBB. When start using tbb, I'm confusing when to use tbb::concurrent_vector, and when std::vector is OK?

 

After searching some forum (c++ - concurrent_vector for 2d array - Stack Overflow), the question still not clear for me.

Is there any clear notes / examples for when to use tbb::concurrent_vector / std::vector.

 

Thanks.

0 Kudos
1 Reply
Mark_L_Intel
Moderator
238 Views

Hello @roderickHuang,  you can find detailed documentation for tbb::concurrent_vector in the oneAPI Specification, concurrent_vector.  It is a thread-safe container that allows, e.g., concurrent growth: multiple threads can concurrently grow the container and append new elements. While std::vector is a regular, not thread-safe container. 

0 Kudos
Reply