J
Jakob Bieling
Mats Weber said:You really have to define what you mean by thread safe for a string
handling package. If you mean that two threads should be able to
concurrently access the same string object, then I think no reasonable
implementation of std::string will do that because the overhead would be
HUGE.
If you just mean that distinct strings can be manipulated concurrently,
then the OP's implementation is just fine because it has no global
variable. The only global resource is memory, and thread safe versions
of new/delete are used in a threaded program.
Microsoft claims to provide a truly thread-safe version for
multithreaded applications of the string class, if I am not mistaken.
regards