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 unordered map data type #591

Merged
merged 3 commits into from
Jun 15, 2024

Conversation

marcauberer
Copy link
Member

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

UnorderedMap<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 20:09
@marcauberer marcauberer enabled auto-merge (squash) June 15, 2024 20:09
@github-actions github-actions bot added std Prs / issues regarding the standard lib compiler labels Jun 15, 2024
@marcauberer marcauberer merged commit 416a77b into main Jun 15, 2024
5 checks passed
@marcauberer marcauberer deleted the feature/unordered-map-iterator branch June 15, 2024 20:17
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/L std Prs / issues regarding the standard lib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant