I wrote a function to return a list<int>::iterator. Everything worked fine. So I decided to make it a template <typename T> function, thus list<T>::iterator. But I get an error saying 'std::list<T>::iterator' : dependent name is not a type.
The first option didn't work. It had build errors. Something about the arguments doesn't match the list type. I don't know!?
But the 2nd option worked. Good idea. I don't know why it just won't take list<T>::iterator as a return type, instead it took <typename iterator> as a return type. Thanks!
You're correct. It does work! It's just my compiler that's acting up. For some reason when I type the code, Visual Studio recognizes the error. BUT if I type the code via NOTEPAD, copy it, then paste it on Visual Studio, it bypasses the error. Isn't that odd? Thanks again.
the second option is probably better anyway because then the function will work with any container type (even straight arrays). Whereas with the first option you can only use lists.