fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct x {
  5. int a;
  6. };
  7. struct px {
  8. x val;
  9. x* operator ->() {return &val;}
  10. };
  11.  
  12. int main() {
  13. px p;
  14. p->a = 4;
  15. cout << p->a << endl;
  16. p.operator->()->a = 5;
  17. cout << p.operator->()->a << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
4
5