Post by n2xssvv g02gfr12930That's not an example of overloading 'operator ->*' but 'operator ->'.
Yep, you're right. My mistake.
struct S
{
int z;
int & operator ->* ( int S::* const & x )
{
return this->*x;
}
};
struct Y
{
int z;
template <typename T>
T & operator ->* ( T Y::* const & x )
{
return this->*x;
}
};
int main()
{
S s;
int S::* pmz = &S::z;
s->*( pmz ) = 3;
Y y;
int Y::* pmy = &Y::z;
y->*( pmy ) = 3;
}