This question already has an answer here:
- What is a nondeduced context? 1 answer
#include <iostream>
#include <vector>
#include <list>
using namespace std;
template <typename T>
void print(typename list<T>::iterator first, typename list<T>::iterator end){
for (; first != end; ++first){
cout << *first << endl;
}
}
int main(){
list <int> list_1 = {0,1,2,3,4,5,6,7,8,9};
print(list_1.begin(), list_1.end());
return 0;
}
void print(typename list<int>::iterator first, typename list<>::iterator end){
for (; first != end; ++first){
cout << *first << endl;
}
}
but when I remove the template parameter, it works. how can I fix the problem to make the template parameter work?
Aucun commentaire:
Enregistrer un commentaire