編譯器警告 (層級 1) C4667
'function' :未定義符合強制具現化的函式範本
您無法具現化尚未宣告的函式範本。
下列範例會導致 C4667:
// C4667a.cpp
// compile with: /LD /W1
template
void max(const int &, const int &); // C4667 expected
若要避免此警告,請先宣告函式範本:
// 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 &);