template Double Linked list template iterator class creation | error

  c++, iterator, pointers

Could you please help me to identify the issue:

iterator class constructors:

DLLIterator();                 // Default Constructor 
DLLIterator(Node<T>* head); 

the functions in double linked list:

DLLIterator<T> begin() const 
{
    return DLLIterator<T> (head); 
}

 DLLIterator<T> end() const 
{
    return DLLIterator<T>(last);
}

****Error C2440 ”: cannot convert from ‘Node *const ‘ to ‘DLLIterator’ DoubleLinkedList 88

Message while compiling class template member function ‘DLLIterator DLList::end(void) const’****

Message No constructor could take the source type, or constructor overload resolution was ambiguous DoubleLinkedList 88

-all are templates
-assuming iterator class is written properly(copy from the same book where we learned Linked lists), template node struct is in the list class and forward declared in iterator class, list class is a friend in the iterator class, linked list returns iterator to main,

some of my least possible guesses is mixed up preprocessor statements or relation between classes: there was an option to make them friends or to forward declared iterator in list class but that gives more errors which make no sense and it was impossible to get list.end() and list.begin() to return iterator pointer to main and instead returning "List::Iterator List’ – error incomplete class return. So i tried many ways and the least errors ( just 1) i have now.

What is interesting the begin function doesn’t complain though it compiled right before the end() function.

Source: Windows Questions C++

LEAVE A COMMENT