Hello I hope someone can explain this problem. This is the code:
class Memory{ public: PacketPtr pkt; MemoryPort* port; MemCtrlQueueEntry(){};
};
And after I do:
std::list<Memory*>::iterator lastIter = NULL;
And I get the following error:
error: conversion from long int to non-scalar type std::_List_iterator<DRAMMemory::MemCtrlQueueEntry*> requested
Where is the problem, of initializing the iterator to NULL?.
Iterators are not pointers. If you want to initialize them to a non-value, use list::end(). The fact that
vector<T>::iteratoris sometime implemented with a pointer is an implementation detail that you cannot depend on.If you want to assign NULL to the value at the location that the iterator is refering to, you have to dereference it first:
Initializing with list::end():