-
November 26th, 2009, 11:25 PM
#1
iterator for a list of template objects
Hi,
I have a compilation probleme when I create my iterator for a stl list of template object. This is the situation
template <typename T>
class A
{
...
};
template <typename T >
class B
{
....
private :
std::list<A<T> >m_MyList;
std::list<A<T> >::iterator m_MyIter;
};
Compiler give me this warning :
warning C4346: 'std::list<A<T> >::iterator' : dependent name is not a type
I have also this error when I use m_MyIter
error C2146: syntax error : missing ';' before identifier 'm_MyIter'
What is the best way to correct ths problem Thank you
}
-
November 26th, 2009, 11:27 PM
#2
Re: iterator for a list of template objects
Originally Posted by Geof
What is the best way to correct ths problem
To declare that the dependent name is indeed a type:
Code:
typename std::list<A<T> >::iterator m_MyIter;
-
November 26th, 2009, 11:35 PM
#3
Re: iterator for a list of template objects
Wow it is not a fast awnser, it a ultra fast awnser. Thank you it solves my problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|