編譯器警告 (層級 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 &);
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: