Can we use boost Pointer Container Library to keep an array of strings winth thread safe push and pop and all such operations?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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_vectoruses anstd::vector<void*>.