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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -