Sample code
std::vector<int> testvectr;
std::vector<int>::iterator it;
testvectr.push_back(10);
it = testvectr.begin(); // method 1 - works
it = &(testvectr[0]); // method 2 - errors as binary '=': no operator found which takes a right-hand operand of type '_Ty *'
Why its throwing error? I am trying to assign a vector index. So later I can call it by *it. But I didn't understand the error behind it. Pls help.
Aucun commentaire:
Enregistrer un commentaire