auto x1 = exp1;
auto& x2 = exp2;
Do I understand correctly that variables declared with auto (x1) will never be const, even if exp1 is const (for ex. a function that returns const). When with auto&(x2) will be const if exp2 will be const. Even if auto is a pointer.
auto it = find(cont.cbegin(), cont.cend(), value);
Here despite I use cbegin and cend it will be non-const iterator, and to be const_iterator I should write
const auto it1 = find(cont.cbegin(), cont.cend(), value);
Aucun commentaire:
Enregistrer un commentaire