jeudi 18 février 2021

is auto type detection only looking at one statement

For the two for loop below, are they equivalent? Basically does the auto look over "=0" assignment and see iter is compared with s.size() and so decides iter is of type decltype(s.size())?

string s;
for(auto iter=0; iter<s.size();iter++)

string s;
for(decltype(s.size()) iter=0; iter<s.size();iter++)

Aucun commentaire:

Enregistrer un commentaire