in an .hpp file, I have a template function which is member of class.
class BLog
{
public:
enum { LOG_ERROR, LOG_WARN, LOG_STATUS, LOG_INFO, LOG_NOTICE, LOG_DEBUG };
template <typename... Args>
void appLog(int prio, const char *fmt, Args const &... args);
template <typename... Args>
void appLogError(const char *fmt, Args const &... args) { this->appLog(LOG_ERROR, fmt, args...); }
}
When calling this,
int main()
{
BLog myLog();
myLog.appLog(BLog::LOG_ERROR, "%s message", "Test");
}
I am getting the warning as
note: see reference to function template instantiation 'void myLog::appLog(int,const char *,const char (&)[5])' being compiled
Can't figure out the proper syntax to pass arguments...
Hope someone can help.Thanks in advance.
Rem: With the proposed answer, using Visual Studio, I always have the warning with the W4
flag.
BLog myLog();
is a function declaration. Use BLog myLog{};
.
myLog::LOG_ERROR
should be BLog::LOG_ERROR
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With