I have a vector of Node*(openList) and I was hoping to get an iterator to the the Node* when a targetNode is given. It should check the x & z position and if a match is found, i would know that this Node* already exists. This is what I have
auto iter = std::find_if(openList.begin(), openList.end(), [&targetNode](const Node* p)
{
return (targetNode->GetXPos() == p->GetXPos() && targetNode->GetZPos() == p->GetZPos());
});
if (iter != openList.end())
{
....do something
}
When I step through Visual Studio, I noticed that there are multiple same entries in openList that is not being caught by the lambda expression. Could anyone enlighten me as to what I had done wrong since I am never entering the do-something loop at all? Thanks alot.