Q
Qian Xin
template<typename T>
class TestCase: public MyClass
{
public:
int stringLength;
vector<T> String;
vector<T>::iterator i;
}
why the above cannot be compiled, gcc reporting the error:
xx.h:53: error: type ‘std::vector<T, std::allocator<_CharT> >’ is not
derived from type ‘TestCase<T>’
xx.h:53: error: expected ‘;’ before ‘i’
But the following can be compiled, any one can give a reason or
reference?
class TestCase: public MyClass
{
public:
int stringLength;
vector<T> String;
typename vector<T>::iterator i;
}
class TestCase: public MyClass
{
public:
int stringLength;
vector<T> String;
vector<T>::iterator i;
}
why the above cannot be compiled, gcc reporting the error:
xx.h:53: error: type ‘std::vector<T, std::allocator<_CharT> >’ is not
derived from type ‘TestCase<T>’
xx.h:53: error: expected ‘;’ before ‘i’
But the following can be compiled, any one can give a reason or
reference?
class TestCase: public MyClass
{
public:
int stringLength;
vector<T> String;
typename vector<T>::iterator i;
}