Reputation: 66945
Can we use boost Pointer Container Library to keep an array of strings winth thread safe push and pop and all such operations?
Upvotes: 2
Views: 396
Reputation: 109149
No, as far as thread safety goes the same rules apply to the pointer container library and the standard C++ library containers. They're both safe for simultaneous read access from different threads but must be protected by mutexes to prevent simultaneous write access.
This is because the containers in the pointer container library simply use an underlying container_type<void*>
of the corresponding standard container to store the objects. For instance, boost::ptr_vector
uses an std::vector<void*>
.
Upvotes: 4
Reputation: 60007
No is the answer. And now I have to make the answer last 30 characters when two would suffice.
Upvotes: 2