I'm doing my best to try and understand pointers but I'm getting a segfault in my program and I think it's because of how I'm trying to use pointers.
I have an iterator iterating over a list of Requester* and activeRequesters is that list of pointers. Then I dereference the first iterator which should give me a Requester*. Then I have an iterator iterating over a list of Request* which are contained in the Requester. Again, I dereference the iterator to get the pointer. Then I try and print track which is an integer contained by a Request.
Could my problem also be in how I'm iterating over the list? I've seen it sometimes done with ++it instead of it++, I'm not sure what the difference is.
Code:for(list<Requester*>::iterator it = activeRequesters.begin();it!=activeRequesters.end();it++)
{
Requester* cur = *it;
cout << "Requester:" << endl;
for(list<Request*>::iterator it2 = cur->requests.begin();it2!=cur->requests.end();it2++)
{
Request* cur2 = *it2;
cout << cur2->track << endl;
}
}