필자는 템플릿에 대한 느낌을 얻기 위해 놀았으며 자체 유형별로 클래스 전문화를 원했습니다. 나는 잠시 동안 인터넷을 검색했지만 이것에 대한 언급은 발견되지 않았다.고유 한 유형을 처리하기위한 템플릿 클래스 특수화
예를 들어나는 class Array
있는 경우 :
template<class T>
class Array{
...
void print();
}
이 방법 print()
T=Array<unspecified type>
전문 가능한가요을?
template<class T>
void Array<Array<T>>::print(){
//do something diffrent for array of array
//this code wont work
}
이 나는이 기능은 매우 유용한 표시되지 않습니다이
template<>
void Array<Array<int>>::print(){
//print in matrix format
//this code works
}
을 관리,하지만 난