I have a class that contains a pointer to a constant VARIANT value outside the class, but sometimes I want to change this pointer to refer to a VARIANT member object of the class itself.
Most instances of this class will be const, so I have to declare the pointer as mutable.
In Visual C++ this code seems to do what I want:
VARIANT mutable const* m_value; However, since mutable is meant to be a property of the pointer and not the pointee, I would think this to be the correct syntax:
VARIANT const * mutable m_value; Similar to how you define a constant pointer (and not a pointer to a const object). Visual C++ does not accept this variant though.
warning C4518: 'mutable ' : storage-class or type specifier(s) unexpected here; ignored
Is Visual C++ right, or am I missing something? Could another more standard-conformant compiler behave differently?