jeudi 18 octobre 2018

C++ Why does 'note: see reference to class template instantiation being compiled'

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(myLog::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.

Aucun commentaire:

Enregistrer un commentaire