Upozornění kompilátoru (úroveň 1) C4667
'function' : žádná šablona funkce definovaná tak, aby odpovídala vynucené instanci
Nelze vytvořit instanci šablony funkce, která nebyla deklarována.
Následující ukázka způsobí C4667:
// C4667a.cpp
// compile with: /LD /W1
template
void max(const int &, const int &); // C4667 expected
Abyste se vyhnuli tomuto upozornění, nejprve deklarujte šablonu funkce:
// C4667b.cpp
// compile with: /LD
// Declare the function template
template<typename T>
const T &max(const T &a, const T &b) {
return (a > b) ? a : b;
}
// Then forcibly instantiate it with a desired type ... i.e. 'int'
//
template
const int &max(const int &, const int &);