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 -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -