Ok, i sorted the problem, thanks Kuphryn.
I need to gain a bit more understanding though and have another question.
Here's some code:
Code:
zone* start_zone = &GetZoneRef(2);
list<zone *>::iterator iter = find(route.begin(),route.end() ,start_zone);
Here is GetZoneRef():
Code:
zone GetZoneRef(int ref)
{
if (zone_main_corridor.GetReference() == ref)
{
return zone_main_corridor;
}
if (zone_adjoining_corridor_lstairs.GetReference() == ref)
{
return zone_adjoining_corridor_lstairs;
}
if (zone_adjoining_corridor_rstairs.GetReference() == ref)
{
return zone_adjoining_corridor_rstairs;
}
if (zone_stairs.GetReference() == ref)
{
return zone_stairs;
}
if (zone_offices_corridor.GetReference() == ref)
{
return zone_offices_corridor;
}
}
The GetReference function is simply a member function to access the integer reference number of the zone.
My question is simply if I am passing in the correct argument at the end of the find() function? It is not working correctly. However if I do:
Code:
list<zone *>::iterator iter = find(route.begin(),route.end() ,&zone_stairs);
instead, it seems to work fine.
Thank you.