我正在编写一个链表,并且我有一个嵌套在另一个类doublylinkedList
中的迭代器类。我想重载前缀运算符
我的代码是:
template <class type>
doublylinkedlist<type>::myiterator & doublylinkedlist<type>::myiterator::operator++() const
{
if(ptr)
ptr=ptr->next;
return (*this);
}
我一直收到这些错误:
warning C4346: 'doublylinkedlist<T>::myiterator' : dependent name is not a type
1> prefix with 'typename' to indicate a type
error C2143: syntax error : missing ';' before '&'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
fatal error C1903: unable to recover from previous error(s); stopping compilation
需要一些帮助。