templates
Hi,
I have problem with compiling something like
1 2 3 4 5 6 7
|
template <class T>
T f(T a)
{
T::iterator it; // I need this iterator in the next line
//...some stuff...
return a;
}
|
Is this doable? T is a class (
std::vector
) with
typedef std::vector::iterator iterator
Yes, though you may need a typename qualifier (I forget) and it would generate errors if instantiated with a class without that typedef.
Try using the
typename
keyword:
1 2 3 4 5 6 7
|
template <class T>
T f(T a)
{
typename T::iterator it; // I need this iterator in the next line
//...some stuff...
return a;
}
|
Topic archived. No new replies allowed.