나는 ... 그래서 같은 cpp에있는 전문 기능을 정의 할 수 있습니다cpp에서 템플릿 전문화를 정의 하시겠습니까?
// 헤더
template<typename T>
void func(T){}
template<>
void func<int>(int);
// cpp에 내가 전문 클래스의 메소드를 정의 할 수있는 방법
template<>
void func<int>(int)
{}
Cpp에? 그래서처럼 ... (작동하지 않는, 나는 error C2910: 'A<int>::func' : cannot be explicitly specialized
수)
// 헤더
template<typename T>
struct A
{
static void func(T){}
};
template<>
struct A<int>
{
static void func(int);
};
// cpp에
template<>
void A<int>::func(int)
{}
당신은 체크 아웃이 되었습니까 : http://stackoverflow.com/questions/115703/storing-c-template-function-definitions-in-a-cpp-file – Reunanen
@Pukku 그 방법의 문제 전문의 비 템플릿 (non-templated) 클래스. 독립 실행 형 함수의 전문화와 실제로 동일합니다 (위의 예제 에서처럼). 나는 cpp의 특수한 _class_에 메소드를 정의하는 방법에 대해 묻고있다. – David