함수 템플릿 '템플릿 이름'을 특수화하지 못했습니다.
비고
컴파일러가 함수 템플릿을 특수화하지 못했습니다. 이 오류의 원인은 여러 가지가 있을 수 있습니다.
일반적으로 C2893 오류를 해결하는 방법은 함수의 서명을 검토하고 모든 형식을 인스턴스화할 수 있는지 확인하는 것입니다.
예시
C2893은 '의 템플릿 매개 변수 f 가 추론되지만 Tstd::map<int,int>멤버 std::map<int,int> 가 없으므로 발생data_type합니다(T::data_type.로 인스턴스화T = std::map<int,int>할 수 없음). 다음 예제에서는 C2893을 생성합니다.
// C2893.cpp
// compile with: /c /EHsc
#include <map>
using namespace std;
class MyClass {};
template<class T>
inline typename T::data_type
// try the following line instead
// inline typename T::mapped_type
f(T const& p1, MyClass const& p2);
template<class T>
void bar(T const& p1) {
MyClass r;
f(p1,r); // C2893
}
int main() {
map<int,int> m;
bar(m);
}