cpp icon indicating copy to clipboard operation
cpp copied to clipboard

docs: add ranged based for loop concept files

Open vaeng opened this issue 1 year ago • 3 comments

vaeng avatar Feb 25 '25 13:02 vaeng

This might deserve a part on using it with auto as well, which is very often used and sometimes less error-prone, like if you forget the const on the key type when traversing a map and it has to copy the element.

vendethiel avatar Feb 26 '25 14:02 vendethiel

This might deserve a part on using it with auto as well, which is very often used and sometimes less error-prone, like if you forget the const on the key type when traversing a map and it has to copy the element.

Do you think we should change the current state further?

The auto keyword comes a bit later in the syllabus, together with smart pointers. Maybe I should move them?

vaeng avatar Feb 26 '25 14:02 vaeng

Good point, I'm not sure. Maybe it should be introduced later, when they might actually mess it up :-)

vendethiel avatar Feb 26 '25 14:02 vendethiel