Reputation: 716
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?
Upvotes: 0
Views: 491
Reputation: 3353
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.
Upvotes: 2