I have a log builder type like so:
Log Log::log(const int logLevel)
{
return Log(logLevel);
}
Log& operator <<(Log& log, const char * s)
{
if (log.hasLogLevel())
log.out << s;
return log;
}
I'm using the above code like this:
Log::log(1) << "Hello logger";
But I'm getting these warnings and it wasn't until recently I realized that it's because the way the operator is overloaded (or at least this is what I'm thinking)
warning C4239: nonstandard extension used : 'argument' : conversion from 'snow::Log' to 'snow::Log &'
I thought this would be fine because it's the same rvalue
? that's being passed/chained through these operator overloads. I don't think this code compiles outside of MSVC++ and I would like to know what I should be doing differently here.
If the solution is to simply use rvalue references then I'm cool with that but I'd like to understand a little better what's going on here.