...my temple hurts.
I'm writing (potentially) template-heavy code, and I've encountered this problem which fortunately can be isolated:
Now when I try to compile this code in GCC it givesCode:#include <vector> template <class a_type> class a_class { public: void foo() { std::vector <a_type>::iterator i; } };
I'm thinking the reason is in the way the STL implements its iterators... you need a well-defined class for them. But I'm not sure.Code:In member function 'void a_class<a_type>::foo()': expected ';' before "i"
EDIT: Okay, after fiddling around I found that using typename would resolve the error. (And finally got a chance to learn what the keyword did.) I'm still open to explanations...



LinkBack URL
About LinkBacks


