Manually I can create a std::vector<int>::iterator object like:
std::vector<int>::iterator i;
So here std::vector<int>::iterator is a type. But when I write a function :
template <class T>
std::vector<T>::iterator foo(std::vector<int>::iterator i)
{
return i;
}
The compiler shows a warning :
std::vector<T>::iterator' : is a dependent name not a type
and the code does not compiles. But if in main I call the function like this:
int main()
{
vector<int> v;
foo(v.begin());
}
The parameter T should be resolved. Then why compiler is showing error?