"C++ 템플릿, 전체 가이드"5 장을 읽었으며 "템플릿 템플릿"템플릿 개념을 보았습니다. 템플릿 클래스에서 템플릿 템플릿 (C++ 11 오류)
, 난 이렇게 내 템플릿을 선언했습니다template <typename TipoClave, typename TipoDato,
template <class Elem, class Alloc = allocator<Elem>> class Lista = vector>
그리고이 작동합니다. 내 문제는 기본값 이외의 다른 컨테이너를 사용하려고 할 때 발생합니다.
class Tabla
{
public:
struct Celda {
TipoClave clave;
TipoDato dato;
};
Tabla(unsigned tam)
{
t.resize(tam);
}
///< Some other functions
private:
typedef Lista<Celda> ListaDatos;
Lista<ListaDatos> t;
};
그리고이 후, 나는이 같은 메인 프로그램에서 사용하려고 할 때 :
int main (void)
{
Tabla<string,Alumno,array> tabla(200);
///< Some stuff
return 0;
}
그러나이 줄 Tabla<string,Alumno,array> tabla(200);
컴파일하지 않고, 저를 받고 다음과 같이
내 클래스입니다 같은 오류 :
test_tabla_t.cpp: In function ‘int main()’: test_tabla_t.cpp:20:27: error: type/value mismatch at argument 3 in template parameter list for ‘template class Lista> class Tabla’ Tabla tabla(200);
나는 Tabla<string,Alumno,vector> tabla(200);
을 사용해 보았습니다. 그것은 작동하므로이 오류를 해결하는 방법을 모르겠습니다.