Saturday, 17 August 2013

C++ Class not being recognised

C++ Class not being recognised

This is the code i have:
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);
}
I get an error on the line where i declared std::ostream& operator<<
(std::ostream& o, LinkedListIter const& lli) saying that LinkedListIter
doesn't name a type. Why is it so?

No comments:

Post a Comment