Hi, I'm trying to iterate through an stl list object list(customer being my struct that holds the name, age and gender variables[customerList being my list]), but I'm getting an error.
void store::listCustomers()
{
vector<customer>::iterator it;
for(it = customerList.begin(); it != customerList.end(); it++)
{
cout << it->name << endl;
cout << it->age << endl;
cout << it->gender << endl;
cout << "*****************" << endl;
}
}
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::list<_Ty>::_Iterator<_Secure_validation>' (or there is no acceptable conversion)
and
error C2679: binary '!=' : no operator found which takes a right-hand operand of type 'std::list<_Ty>::_Iterator<_Secure_validation>' (or there is no acceptable conversion)
This is telling me I cant use = and !=, but I thought this is how you use an iterator. Help please!
Thanks
Edit: Nevermind, I declared my iterator as a vector type instead of list type. =p