I trying to initialize:
template DoubleLinkedList<Student>::DoubleLinkedList(typename Student<int> _data);
//error: Explicit instantiation of 'DoubleLinkedList' does not refer to a function template...
And constructor code is:
template <template <class> class T> DoubleLinkedList<T>::DoubleLinkedList(T<class _T> _data){
head = NULL;
curr = NULL;
len = 0;
push(_data);
};
Template class that trying to convey:
template <template <class> class T> class DoubleLinkedList{};
Template in the which trying to convey:
template <class _T> class Student
UP
one more question: I have a structure in class in class. How can I turn to him?
curr = curr::_data->__name; // wrong
You roughly want this:
template <template <class> class T>
class DoubleLinkedList
{
DoubleLinkedList(T<int> _data);
// ...
};
template <template <class> class T>
DoubleLinkedList<T>::DoubleLinkedList(T<int> _data)
{
head = NULL;
// ...
push(_data);
}
Usage:
Student<int> s;
DoubleLinkedList<Student> x(s);