Query about STL list
-
Hi, I am trying some code similar to what I have posted below, but it is not being compiled on the VC++ 7.0 :(, and on VC++ 6.0 it gives a
INTERNAL_COMPILER_ERROR
X| :#include <list> ... template <class clDataType> class CMyData { clDataType myObj; // Typically will be a string type only unsigned long myObjSize; public: ... }; template <class clDataType> class CMyManager { unsigned int nIndex; clDataType myData; // This is ALSO required list<CMyData<clDataType>> myList; // :sigh: This is making me :(( public: ... };
What I am trying is to have a STL list of
CMyData<clDataType>!
:confused: Is it possible or am I doing some mistake?! :doh: Thanks, Rgds, Nirav * Don't wish it was easier, wish you were better! * -
Hi, I am trying some code similar to what I have posted below, but it is not being compiled on the VC++ 7.0 :(, and on VC++ 6.0 it gives a
INTERNAL_COMPILER_ERROR
X| :#include <list> ... template <class clDataType> class CMyData { clDataType myObj; // Typically will be a string type only unsigned long myObjSize; public: ... }; template <class clDataType> class CMyManager { unsigned int nIndex; clDataType myData; // This is ALSO required list<CMyData<clDataType>> myList; // :sigh: This is making me :(( public: ... };
What I am trying is to have a STL list of
CMyData<clDataType>!
:confused: Is it possible or am I doing some mistake?! :doh: Thanks, Rgds, Nirav * Don't wish it was easier, wish you were better! *Your problem is this line:
list<CMyData<clDataType>> myList;
due to the lexical analysis of C++ it has to be written as this:list<CMyData<clDataType> > myList;
as such the space is crucial. The >> is parsed as right-shift, even though it makes little sense in that context (also is why it causes an error). Hope that helps. -- Henrik Stuart (http://www.unprompted.com/hstuart/) -
Your problem is this line:
list<CMyData<clDataType>> myList;
due to the lexical analysis of C++ it has to be written as this:list<CMyData<clDataType> > myList;
as such the space is crucial. The >> is parsed as right-shift, even though it makes little sense in that context (also is why it causes an error). Hope that helps. -- Henrik Stuart (http://www.unprompted.com/hstuart/)Hello Henrik, It worked!... Thanks a ton! :-O... Well pointed out! So much about Micro$oft Compiler! Thanks, Rgds, Nirav * Don't wish it was easier, wish you were better! *
-
Hello Henrik, It worked!... Thanks a ton! :-O... Well pointed out! So much about Micro$oft Compiler! Thanks, Rgds, Nirav * Don't wish it was easier, wish you were better! *
Hey, You're welcome. It isn't, however, limited to Microsoft's compiler, it's mandated in ISO/IEC 14882:1998 and as such part of C++ as a language. You would get the same behaviour in any other C++ compiler. :) -- Henrik Stuart (http://www.unprompted.com/hstuart/)
-
Hey, You're welcome. It isn't, however, limited to Microsoft's compiler, it's mandated in ISO/IEC 14882:1998 and as such part of C++ as a language. You would get the same behaviour in any other C++ compiler. :) -- Henrik Stuart (http://www.unprompted.com/hstuart/)
Oh, is it?! My apologies to Bill Gate$ & Micro$oft! * Don't wish it was easier, wish you were better! *
-
Oh, is it?! My apologies to Bill Gate$ & Micro$oft! * Don't wish it was easier, wish you were better! *
Don't apologize. The VC should report this as a parse error, not internal compiler error! :) Robert-Antonio Love, truth and electric traction must gain victory over hate, lie and diesel traction.