Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iterator for map data type #590

Merged
merged 13 commits into from
Jun 15, 2024
Merged

Add iterator for map data type #590

merged 13 commits into from
Jun 15, 2024

Conversation

marcauberer
Copy link
Member

Add iterator for map data type. This makes Map<T, U> type compatible with foreach loops. So now this is possible:

Map<int, int> map;
map.insert(1, 2);
map.insert(2, 3);
map.insert(3, 4);
map.insert(4, 5);
map.insert(5, 6);
foreach Pair<int&, int&> item : map {
    printf("%d: %d\n", item.getFirst(), item.getSecond());
}

@marcauberer marcauberer added the enhancement New feature or request label Jun 15, 2024
@marcauberer marcauberer added this to the 0.21.0 milestone Jun 15, 2024
@marcauberer marcauberer self-assigned this Jun 15, 2024
@marcauberer marcauberer requested review from a team as code owners June 15, 2024 16:08
@github-actions github-actions bot added std Prs / issues regarding the standard lib compiler labels Jun 15, 2024
@marcauberer marcauberer enabled auto-merge (squash) June 15, 2024 16:12
@marcauberer marcauberer merged commit d606078 into main Jun 15, 2024
5 checks passed
@marcauberer marcauberer deleted the feature/map-iterators branch June 15, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler enhancement New feature or request size/XL std Prs / issues regarding the standard lib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant