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 simplestl std::unordered_map #5859

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

whyb
Copy link
Contributor

@whyb whyb commented Dec 31, 2024

simplestl std::unordered_map

online compiler : https://coliru.stacked-crooked.com/a/a6c633f30aaed522

test code:

std::unordered_map<int, int> map1;
map1.insert(std::make_pair(1, 21));
map1.insert(std::make_pair(0, 10));
map1[0] = 20;
map1.erase(1);
map1.emplace(1, 11);
map1.insert(std::make_pair(2, 12));
map1.emplace(3, 13);

printf("map1 key %d has value %d\n", 0, map1.at(0));
printf("map1 key %d has value %d\n", 2, map1[2]);
printf("map1 size is %ld\n", map1.size());
printf("map1 is empty %s\n", map1.empty() ? "True" : "False");

map1.clear();

@github-actions github-actions bot added the core label Dec 31, 2024
@tencent-adm
Copy link
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants