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

How to get the arclen between two curve points in Maya? -

git svn - Unignore directories in git-svn (adding directories to a sparse checkout) -

C++ Linked List -