C++ 班级不被承认
这是我的代码:C++ 班级不被承认,c++,class,C++,Class,这是我的代码: template <class a, class b> class LinkedListIter{ public: LinkedListIter(b* iterable){ this->iterable = iterable; this->head = this->iterable->head; this->curr = this->
template <class a, class b>
class LinkedListIter{
public:
LinkedListIter(b* iterable){
this->iterable = iterable;
this->head = this->iterable->head;
this->curr = this->iterable->curr;
this->iter_pos = 0;
};
void operator++(int dummy){
this->iter_pos++;
};
friend std::ostream& operator<< (std::ostream& o, LinkedListIter const& lli);
private:
a* head;
a* curr;
b* iterable;
int iter_pos; //The current position if the iterator
};
std::ostream& operator<< (std::ostream& o, LinkedListIter const& lli){
return o << lli.get(lli.iter_pos);
}
模板
类链接列表{
公众:
链接列表(b*iterable){
这->iterable=iterable;
此->头部=此->可伸缩->头部;
this->curr=this->iterable->curr;
本->国际热核聚变实验堆位置=0;
};
void运算符++(int虚拟){
本->iter_pos++;
};
friend std::ostream&operatorLinkedLister
是一个类模板,而不是一个类。因此,您的操作符也需要是一个模板
template<typename a, typename b>
std::ostream& operator<< (std::ostream& o, LinkedListIter<a,b> const & lli){
...
模板
std::ostream&operatorLinkedLister
是一个类模板,而不是一个类。因此,您的操作符也需要是一个模板
template<typename a, typename b>
std::ostream& operator<< (std::ostream& o, LinkedListIter<a,b> const & lli){
...
模板
std::ostream和操作员#包括
模板
类链接列表;
模板
std::ostream&operateritable=iterable;
此->头部=此->可伸缩->头部;
this->curr=this->iterable->curr;
本->国际热核聚变实验堆位置=0;
};
void运算符++(int虚拟){
本->iter_pos++;
};
friend std::ostream&operator#包含
模板
类链接列表;
模板
std::ostream&operateritable=iterable;
此->头部=此->可伸缩->头部;
this->curr=this->iterable->curr;
本->国际热核聚变实验堆位置=0;
};
void运算符++(int虚拟){
本->iter_pos++;
};
friend std::ostream&operator@AnshumanDwibhashi:如果你有其他问题,最好单独发表一篇文章。@AnshumanDwibhashi:如果你有其他问题,最好单独发表一篇文章。