template iterator issue on vc8

follwoing snippet of code is working on vc7,gcc4.0.2 but breaking in vc8.

#include
<list>

using namespace std;

template<typename T>

class M{

public:

list<T> l;

list<T>::iterator it; //this gives error

};

int main()

{

}

error reported by the visual studio2005 vc8 is:

error C2146: syntax error : missing ';' before identifier it' 
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 



Answer this question

template iterator issue on vc8

  • Tacho

    You have to use a typename keyword!


    template<typename T>
    class
    M{
    public
    :
    list<T> l;
    typename list<T>::iterator it;
    };

     


  • template iterator issue on vc8