I am attempting to execute this snippet of code:
Code:
bool Region::ContainsAgent ( Agent *myAgent )
{
if ( find(RegionalAgents.begin(), RegionalAgents.end(), myAgent) != RegionalAgents.end() )
return true;
else return false;
}
RegionalAgents is an STL vector of type Agent*. I am passing an Agent* into the function, so essentially I just want to see if that pointer is contained in the RegionalAgents vector. Not too difficult....pretty simple concept. Unfortunately gcc is not liking it.
When I compile it on Linux with gcc 4.3, it gives me an error saying:
Code:
[dpru@cycling]$ make agents
g++ -Wall -o agents_simulation src/agent.cpp src/belief.cpp src/group.cpp
src/region.cpp src/simulation.cpp src/world.cpp src/main.cpp
src/region.cpp: In member function âbool Region::ContainsAgent(Agent*)â:
src/region.cpp:31: error: no matching function for call to
find(__gnu_cxx::__normal_iterator<Agent**, std::vector<Agent*,
std::allocator<Agent*> > >, __gnu_cxx::__normal_iterator<Agent**,
std::vector<Agent*, std::allocator<Agent*> > >, Agent*&)
make: *** [agents] Error 1
Any ideas what my error could be?