I have a problem to solve. I am working my way tgrough a list with an iterator. At some points I need to pass the address of the object that the iterator is pointing to. How do I do this? My code look somewhat like this:
Code:
list<TASK>::iterator taskIter;
...
for (taskIter = task.begin(); taskIter != task.end(); ++taskIter)
{
if (taskIter->getNextXmit() <= time)
{
newMsg = new MSG(address of the particular task); <- here is my problem
}
}
-----
class MSG
{
protected:
TASK *taskPtr; /* parent task */
...
public:
...
MSG::MSG(TASK *task)
{
this->taskPtr = task;
}
...
In my MSG object I need a pinter to the TASK object, so I am trying to pass it. I thought that the iterator was, basically, a pointer to the object, but I can not find out how to get it to look like a pointer to the object.