K
kf3cr
I am including the code that does not compile below. I am curious as to
why this does not compile, and I would appreciate it if anybody knew
where in the c++ standard I could info to better understand this issue.
For the sake of this post I am going to assume that gcc 4.2.1 is better
with the c++ standard than my copy of visual studio 2009 version
9.0.30729.1 SP since gcc gives the error and visual studio compiles it.
gcc Error text:
main.cpp: In member function 'void B<G>::f()':
main.cpp:22: error: expected ';' before 'itr2'
#include <vector>
template <typename T>
class A
{
public:
typedef std::vector<int> stuffs;
typedef stuffs::const_iterator ConstIterator;
};
template <typename G>
class B
{
public:
void f(void)
{
A<bool>::ConstIterator itr1; // this is ok
A<G>::ConstIterator itr2; // Problem here
}
};
int main(void) {return 0;}
why this does not compile, and I would appreciate it if anybody knew
where in the c++ standard I could info to better understand this issue.
For the sake of this post I am going to assume that gcc 4.2.1 is better
with the c++ standard than my copy of visual studio 2009 version
9.0.30729.1 SP since gcc gives the error and visual studio compiles it.
gcc Error text:
main.cpp: In member function 'void B<G>::f()':
main.cpp:22: error: expected ';' before 'itr2'
#include <vector>
template <typename T>
class A
{
public:
typedef std::vector<int> stuffs;
typedef stuffs::const_iterator ConstIterator;
};
template <typename G>
class B
{
public:
void f(void)
{
A<bool>::ConstIterator itr1; // this is ok
A<G>::ConstIterator itr2; // Problem here
}
};
int main(void) {return 0;}