mardi 3 octobre 2017

Reference referring to multiple objects, how is it possible?

In one of the C++ books i am reading :

int v[] = {0,1,2,3,4,5,6,7,8,9}; for (auto& x : v)

When next line in the book says :

".. a reference cannot be made to refer to a different object after its initialization..."

x refers to all v's object, how does it work?

Aucun commentaire:

Enregistrer un commentaire