I'm having a problem here and I thought I would find an easy answer on the Internet, but it's been 1 hour and I can't solve it. Seems so simple, but I can't find a way...
I've got 2 classes:
#include <iostream>
#include <list>
using namespace std;
class classB;
class classA{
private :
string name;
list<classB*> listClassB;
public:
void getListClassB() const;
};
class classB{
private:
string name;
list<classA*> listClassA;
public:
void getListClassA() const;
};
What I do on the getListClassB()
method is:
void classA::getListClassB() const {
for(list<classB*>::iterator it = listClassB.begin(); it != listClassB.end; it++){
//Stuff
}
}
Visual Studio Code tells me that there is an error is on listClassB
from list<classB*>::iterator it = listClassB.begin()
The complete error about that is:
there is no appropriate user-defined conversion of
"std::_List_const_iterator<std::_List_val<std::conditional_t<true, std::_List_simple_types<classB *>, std::_List_iter_types<classB *, size_t, ptrdiff_t, classB **, classB *const *, classB *&, classB *const &, std::_List_node<classB *, void *> *>>>>\" in \"std::_List_iterator<std::_List_val<std::conditional_t<true, std::_List_simple_types<classB *>, std::_List_iter_types<classB *, size_t, ptrdiff_t, classB **, classB *const *, classB *&, classB *const &, std::_List_node<classB *, void *> *>>>>"
EDIT:
Ok, so thanks again for all your time, but this error makes me crazy.
I completed a bit the code to be more explicit about my work.
I don't go deeper because it's college work in France, and it's about UML classes, so it's class linked with others classes...