My problem is that in my class template method
template <typename T> void MyQueue<T>::Print(){
std::vector <double>::iterator It1;
It1 = data.begin();
for ( It1 = data.begin( ) ; It1 != data.end( ) ; It1++ )
cout << " " << *It1<<endl;
}
template <typename T> void MyQueue<T>::Print(){
std::vector <double>::iterator It1;
It1 = data.begin();
for ( It1 = data.begin( ) ; It1 != data.end( ) ; It1++ )
cout << " " << *It1<<endl;
}
To copy to clipboard, switch view to plain text mode
this will only work for doubles since It1 is instantiated with doubles. I wanted to change this so that it will work on any T.
and the only thing i can think of is using special template and give each type a print method
baray98
Bookmarks