J
Juha Nieminen
I have some data inside a struct instance in a namespace and I want to
initialize that data before spawning a thread which will read that data.
In order to make sure that the data will indeed get written before the
other thread reads it (ie. to make sure the compiler doesn't perform
some funny optimizations which will mess things up) I make that struct
instance volatile.
The problem is: The struct has some std::strings inside it. I can't
assign anything to these strings (at least not with gcc). I just get an
error that there's no matching operator=. Without the 'volatile' there's
no error.
Is it simply impossible to assign anything to a volatile std::string?
initialize that data before spawning a thread which will read that data.
In order to make sure that the data will indeed get written before the
other thread reads it (ie. to make sure the compiler doesn't perform
some funny optimizations which will mess things up) I make that struct
instance volatile.
The problem is: The struct has some std::strings inside it. I can't
assign anything to these strings (at least not with gcc). I just get an
error that there's no matching operator=. Without the 'volatile' there's
no error.
Is it simply impossible to assign anything to a volatile std::string?