I
Ian C
Hello all
Apologies if this is a dumb question, but this is driving me nuts, and
I'm really an old procedural programmer so not sure if it's me or the
compiler at fault. I can perhaps guess
I have written a derived streambuf class so I can log to a
system-dependent logging interface. I use this in a derived class like so:
class Syslog : public std:stream
{
public:
Syslog(eSyslogLevel level)
: std:stream(new SyslogBuffer(level))
{
}
};
If I use a variable to use this class, it compiles fine:
Syslog str(SYSLOG_INFO);
str << "Test Number " << 1 << std::endl;
However, if I use it as a temporary object like this:
Syslog(SYSLOG_INFO) << "Test Number " << 1 << std::endl;
the compiler complains that it can't find a match for operator<< for the
Syslog class and the character array.
Am I going mad, or just doing something dumb?
Cheers.
Ian C
Apologies if this is a dumb question, but this is driving me nuts, and
I'm really an old procedural programmer so not sure if it's me or the
compiler at fault. I can perhaps guess
I have written a derived streambuf class so I can log to a
system-dependent logging interface. I use this in a derived class like so:
class Syslog : public std:stream
{
public:
Syslog(eSyslogLevel level)
: std:stream(new SyslogBuffer(level))
{
}
};
If I use a variable to use this class, it compiles fine:
Syslog str(SYSLOG_INFO);
str << "Test Number " << 1 << std::endl;
However, if I use it as a temporary object like this:
Syslog(SYSLOG_INFO) << "Test Number " << 1 << std::endl;
the compiler complains that it can't find a match for operator<< for the
Syslog class and the character array.
Am I going mad, or just doing something dumb?
Cheers.
Ian C