c++11 - operator == () loops for ever -
see simple code:
struct  {         bool operator ==(const int &t)      {          return *this == t;      }  }; void main() {     p;     p == 2;// code loops ever!!!  } dose 1 know why code loops ever ?! operator ==() calls recursively!
 many thanks
ask this.
what *this? it's struct a.
so *this == t ? a::operator==() argument t.
you calling same function.
Comments
Post a Comment