I´m currently learning C++ and I decided to try to write my own "log tool". My goal is, that I can write just something like this:
logger<<"log message";
I have this problem - when I wrote operator << overloading function, the IDE compiler warned me, that it is infinite recursion.
Here is the code of operator overloading:
Logger &operator<<(Logger &logger, char *message)
{
logger << message << "Log message";
return logger;
}
And function is in class declared as friend:
friend Logger &operator<<(Logger &logger, char *message);
Why is this code infinite recursion? Maybe I just can´t see some trivial mistake...
Thank you for your answers.