template<class T>;
class Record
{
public:
static vector<T>; m_t;
static vector<T>;::iterator position;
public:
Record();
~Record();
};
template<class T>;
vector<T>; Record<T>;::m_t;
template<class T>;
vector<T>;::iterator Record<T>;::position;
template<class T>;
Record<T>;::Record()
{
m_t.reserve(80);
};
template<class T>;
Record<T>;::~Record()
{
};
环境
Solaris9-X86
gcc 3.4.1
针对
static vector<T>;::iterator position;
的编译错误如下:
error: type `std::vector<T, std::allocator<_CharT>; >;' is not derived from type `Record<T>;'
error: ISO C++ forbids declaration of `iterator' with no type
class Record
{
public:
static vector<T>; m_t;
static vector<T>;::iterator position;
public:
Record();
~Record();
};
template<class T>;
vector<T>; Record<T>;::m_t;
template<class T>;
vector<T>;::iterator Record<T>;::position;
template<class T>;
Record<T>;::Record()
{
m_t.reserve(80);
};
template<class T>;
Record<T>;::~Record()
{
};
环境
Solaris9-X86
gcc 3.4.1
针对
static vector<T>;::iterator position;
的编译错误如下:
error: type `std::vector<T, std::allocator<_CharT>; >;' is not derived from type `Record<T>;'
error: ISO C++ forbids declaration of `iterator' with no type
模板类中使用iterator成员出错,求救 在vector<T>;::iterator前面加上typename就可以了 static typename vector<T>;::iterator position; ... template<class T>; typename vector<T>;::iterator Record<T>;::position; |