When we want to print elements of list
void printCollection(T coll){
auto it=coll.begin();
while(it != coll.end())
{
cout << *it << ' ';
it++; // HERE
}
cout << endl;
}
so, when using it++ from begin to end-1 .. then list is contiguous because of moving to next addresses in memory by it++ .. Is that true?
Aucun commentaire:
Enregistrer un commentaire