Variadic template resolution in VS2013 - Error C3520

前端 未结 2 1475
野的像风
野的像风 2021-01-26 18:44

What\'s wrong with this code?

enum LogLevel {
    LogLevel_Error = 1,
    LogLevel_Warning = 2,
    LogLevel_Info = 3,
    LogLevel_Debug = 4
};

LogLevel GetLog         


        
2条回答
  •  庸人自扰
    2021-01-26 19:19

    I see the following issues:

    1. rest needs to be expanded:

      Write(level, ss, rest...);
      
    2. Write is supposed to take a log level as its first argument:

      Write(GetLogLevel(), std::stringstream(), "Hello", (const char*)" World!", 1);
      
    3. You can't pass a temporary std::stringstream to an lvalue reference:

      std::stringstream ss;
      Write(GetLogLevel(), ss, "Hello", (const char*)" World!", 1);
      

提交回复
热议问题