tbb - concurrent_vector address to memory?

448 Views Asked by At

I'm trying to get a reference to the memory of a concurrent_vector in TBB (Threaded Building Blocks) in a way similar to std::vector.

So an std::vector would be accessed like: &stdVector[0].

But the equivalent for a concurrent_vector doesn't work: &tbbVector[0].

I guess this may have something to do with how the memory is stored internally in order to be concurrent, but is there a way to do this?

1

There are 1 best solutions below

2
On BEST ANSWER

unlike std::vector, concurrent_vector does not provide a guarantee of contiguous storage. So taking the address of the first element and doing anything other than accessing the first element is not a good idea.