Skip to content

docs: add ranged based for loop concept files - #945

Open
vaeng wants to merge 4 commits into
mainfrom
add-range-based-loop-concept
Open

docs: add ranged based for loop concept files#945
vaeng wants to merge 4 commits into
mainfrom
add-range-based-loop-concept

Conversation

@vaeng

Copy link
Copy Markdown
Contributor

No description provided.

@vaengvaeng added the x:type/docs Work on Documentation label Feb 25, 2025
Comment threadconcepts/ranged-loops/introduction.md Outdated
Comment threadconcepts/ranged-loops/introduction.md Outdated
Comment threadconcepts/ranged-loops/introduction.md Outdated
@vendethiel

Copy link
Copy Markdown

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.

@vaeng

vaeng commented Feb 26, 2025

Copy link
Copy Markdown
ContributorAuthor

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?

@vendethiel

Copy link
Copy Markdown

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

iHiD
iHiD approved these changes Mar 5, 2025
- `container`: The array or vector to loop over.

## Example Usage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This took me a minute to work out but I like it! :)

Maybe it would be worth saying...

Suggested change
In this code, we loop over each word, retrieving the first letter each time, to reveal the obscured password.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:type/docsWork on Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vaeng@vendethiel@iHiD@tasxatzial