#include <iostream>
#include <functional>
using FuncType = std::function<std::string()>;
template <typename... Args>
std::string AnalysisRaw(const std::string& tmp, const Args&... args)
{
return std::string();
}
template <typename... Args>
inline void log(const char* fmt, const Args&... args)
{
std::string tmp = "";
FuncType type = std::bind(&AnalysisRaw<Args...>, tmp, args...);
}
int main()
{
log("xxx", "yyy");
return 0;
}
The code above is meaningless, just to show the problem.
There is a compile error says that "cannot convert ..." and "No constructor could take the source type, or constructor overload resolution was ambiguous".
However, if I call "log" function such as
log("xxx", (const char*)"yyy");
there is no compile error. It seems that const char (&)[] performs differently against const char*
Aucun commentaire:
Enregistrer un commentaire