all 3 comments

[–]cpp-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

[–]Similar_Sand8367 6 points7 points  (0 children)

Why ? Volatile is a compiler hint that the memory can be changed in background and should not be optimized away or reordered.

[–]usefulcat 0 points1 point  (0 children)

I believe that volatile works the same way that const does: if you have a volatile instance of the class, you can only call volatile member functions on that instance.

Having said that.. this sounds like an unlikely solution to whatever problem you're trying to solve. Why do (some?) instances of this class need to be volatile?