Original Post
template<class T>
class MyClass
{
public:
myMethod();
};
template<class T>
void MyClass<T>::myMethod()
{
vector<string>::iterator it1;
vector<T*>::iterator it2; //error happens here
//More code here
}
template<class T>
class MyClass
{
public:
myMethod();
};
template<class T>
void MyClass<T>::myMethod()
{
vector<string>::iterator it1;
vector<T*>::iterator it2; //error happens here
//More code here
}
template<class T>class MyClass{public: myMethod();};template<class T>void MyClass<T>::myMethod(){ vector<string>::iterator it1; typename vector<T*>::iterator it2; //More code here}vector<string>::iterator it1; // Independent type. (Although, the actual term is, *ahem* non-dependent.)vector<T*>::iterator it2; // Dependent type.Quote:
vector may or may not be dependent (I don't know) but vector is known from global scope to be a class so there's no issue.
Quote:
G++ is more strict in correctness here, and most places it seems, about not assuming that ::iterator is a type. I suppose this is to enforce proper, portable code.
What was once: std::allocator<T>::rebind::type::rebind<V>::typeIs now: typename std::allocator<T>::template rebind::type::template rebind<V>::typeThis topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more