I have this dummy template function that takes a vector of some type T, and returns the first element by using an iterator. This is just a simplification of what I'm trying to do so please don't focus on the fact that this function is useless:
1 2 3 4 5
template<class T>
T myfun(vector<T>& vec) {
vector<T>::iterator it = vec.begin(); //error: "expected ';' before 'it'"
return *it;
}
Would really appreciate any advice as to what it is that I'm doing wrong...
You and I were working on the same problem this evening, but I can't get my calls to my template function to compile. Could you post a line of code with a call to your template function, please? Maybe it will help me figure out what I might be doing wrong.