This question has been discussed but I haven't seen a set answer yet. It's partially discussed here:
https://www.justsoftwaresolutions.co.uk/cplusplus/const-and-thread-safety.html
But the answer still isn't totally clear with me.
If you define std::string const kstrValue = "Value"
is kstrValue
inherently thread-safe?
What my research has indicated is that it is thread-safe as long as you don't call std library functions that mutate the string.
Is this true?
Aucun commentaire:
Enregistrer un commentaire