Templated function and stl
I defined a templated function as below:
Code:
template<class T>
list<T *>::iterator FindInternalByID(list<T *> *_List, int _ID){
list<T *>::iterator i;
for (i = _List->begin(); i != _List->end(); i++){
if ((*i)->GetID() == _ID){
return i;
}
}
return _List->end();
};
Compiler gives an error:
error C2146: syntax error : missing ';' before identifier 'FindInternalByID'
I tried some other definitions and found that if i dont return an iterator like the above, no error occurs.
How can I correct this?