Hello,
I have a node defined as
Code:
struct node
{
string data;
int val;
}
I have a vector<node> and a list<node>.
Code:
vector<node> vectorName{/* initialized to some value */};
list<node> listName{/* initialized to some value */};
I want to run find() on the list<node> for every node in the vector<node>.
something like
Code:
for(auto itr = vectorName.begin(); itr != vectorName.end(); ++itr)
{
auto item = find(listName.begin(), listName.end(), *itr);
// do something with item
}
but I keep getting a compiler error when I try to compile. Looks like I am doing something wrong in the find() call. I understand that itr is pointing to a node in the vector. but shouldn't I be able to pass *itr which is just a node as the third argument to find()?
This is the error I am getting
error C2678: binary '==': no operator found which takes a left-hand operand of type 'node' (or there is no acceptable conversion)