Type and Dependent Name
c++, templates, types
Solution
Following link has a solution and answer,
"Dependent Name is not a Type", but prefixing with "typename" causes compiler crash
In short, "std::vector::iterator" is a dependent name not a typename. So you can not use directly as a typename. You have to specify "typename std::vector::iterator".
Problem
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?