I need to assign set<> iterator to pointer, while I pass set as argument void ProcessVessel(ContainerTerminal* containerTerminal, set<ArrivedVessel> * arrivedVesselPool)
whereas
ArrivedVessel
is a class and after that I made iterator std::set<ArrivedVessel>::iterator it;
for loop and I made for loop for (it = arrivedVesselPool->begin(); it != arrivedVesselPool->end(); it++)
, till now compiler doesn't show me any error but when I assign it
to the pointer which is Vessel* currentVessel
like this currentVessel = &(*it);
, compiler gives error
A value of type 'const ArrivedVessel*' cannot be assigned to an entity of type 'vessel*'.
However for converting iterator I found it on this link iterator to pointer conversion but I couldn't understand it perfectly.
Here is the piece of source code
void ProcessVessel(set<ArrivedVessel> * arrivedVesselPool) {
std::set<ArrivedVessel>::iterator it;
for (it = arrivedVesselPool->begin(); it != arrivedVesselPool->end(); it++)
{
Vessel* currentVessel;
currentVessel = &(*it);}
Any suggestions would be very helpful. Thank you in advance.