Is ostringstream thread safe

Oct 28, 2010 at 7:30am
hi all,

I am wondering whether ostringstream is thread safe. I used ostingstrteam as below in a class.

static ostringstream oss;

If not thread safe, Is there any way to use oss as thread safe object.

Thanks in advance.
Oct 28, 2010 at 11:54am
No. No part of the STL is thread-safe. (No object in general is thread-safe.)
You will have to use the usual locking mechanisms before handling any object.

When playing with streams, I would think that would be a given, since synchronization is an issue.

Hope this helps.
Topic archived. No new replies allowed.