Consider the following code:
struct Foo
{
mutable int m;
template<int Foo::* member>
void change_member() const {
this->*member = 12;
}
void g() const {
change_member<&Foo::m>();
}
};
The compiler generates an error message. The fact is that the member has been mchanged, so he is allowed to change m. But the signature of the function hides the volatile declaration.
How to declare a pointer to-mutable-member to compile this code? If this is not possible, refer to the C ++ standard.
source
share