How can I assign values to elements of std::vector
using "for each" instruction?
I tried to do something like this:
std::vector<int> A(5);
for each(auto& a in A)
a = 4;
But then I get the following error:
error C3892 : 'a' : you cannot assign to a variable that is const
Aucun commentaire:
Enregistrer un commentaire