I am writing a simple logger class similar to QDebug, which has a template method that save data into QStringList. The code is here:
#include
The name log
is looked up twice. At the point of template definition, ordinary lookup is performed. It doesn't find anything, since log
is not declared at this point.
Then, at the point of instantiation, only argument-dependent lookup is performed. When the parameter is of type QString
, the global namespace is searched since QString
is declared there, and so log(QString)
is found. But the type int[]
doesn't have any associated namespaces, so argument-dependent lookup has nothing to search and finds nothing. Hence the error.