So, I'm trying to get code written to compile gcc on Visual Studio 2008. I have a problem that I narrowed down to this:
class value_t { public: typedef std::deque<value_t> sequence_t; typedef sequence_t::iterator iterator; };
This code does not work:
1>cpptest.cpp 1>c:\program files\microsoft visual studio 9.0\vc\include\deque(518) : error C2027: use of undefined type 'value_t' 1> c:\temp\cpptest\cpptest.cpp(10) : see declaration of 'value_t' 1> c:\temp\cpptest\cpptest.cpp(13) : see reference to class template instantiation 'std::deque<_Ty>' being compiled 1> with 1> [ 1> _Ty=value_t 1> ] 1>c:\program files\microsoft visual studio 9.0\vc\include\deque(518) : error C2027: use of undefined type 'value_t' 1> c:\temp\cpptest\cpptest.cpp(10) : see declaration of 'value_t'
However, when I try to do this with std :: vector, it compiles fine:
class value_t { public: typedef std::vector<value_t> sequence_t; typedef sequence_t::iterator iterator; };
What happened? I tried adding โtypenameโ everywhere I can think of, but for now I think it's just a bug in the Dinkumware STL. Can someone explain what is happening and / or suggest a solution? Thanks.
c ++ templates
Roel
source share