[Click] Perhaps trivial question

Bart Braem bart.braem at ua.ac.be
Thu Nov 18 03:27:42 EST 2004


Hello,

In my code I need to traverse a whole Hashmap, use the data inside each entry 
and then delete that entry. I tried using the erase method based on 1 
iterator (later also with 2 iterator arguments) but it doesn't compile: my 
iterator is incompatible with void**:
../include/click/vector.hh: In member function `T**
   Click::Vector<T*>::erase(T**) [with T = Click::Packet]':
../elements/aodv/aodv_waitingfordiscovery.cc:156:   instantiated from here
../include/click/vector.hh:239: error: invalid conversion from `void**' to `
   Click::Packet**'


How is that solved? I see other people use it and it works there. The 
difference is that in all available code erase is used on vector.begin() and 
vector.begin()+1. But those are iterators, right? If I use the following 
(pair->value.packets has type Vector<Packet*>) I get that compiler error:

pair->value.packets.erase(pair->value.packets.begin());

Any help is appreciated as currently I use the back() and pop_back() methods 
but that's not really safe.

Thanks
Bart


More information about the click mailing list