ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

add simplestl std::unordered_map

Open whyb opened this issue 1 year ago • 1 comments

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();

whyb avatar Dec 31 '24 10:12 whyb

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.

tencent-adm avatar Dec 31 '24 10:12 tencent-adm