【发布时间】:2015-05-17 19:27:26
【问题描述】:
我需要一个简单的 API
int id = Put(value);
void Remove(id);
// and some kind of for_each that could iterate over all data ( there will be around ~1000 objects or less), and this is operation that will be calld super often compared to Put and Remove
isextreamly 在许多 C++ 会议中都在讨论 std::map 有多慢。实际上我并不需要它的所有成员。因此,在这种印象下,我寻找一种可以满足我缩小需求的替代方案。
【问题讨论】:
-
您实际尝试过什么,需要多快? (我希望在现代台式电脑上在 std::map 中添加然后删除 1000 个元素会在不到 1 毫秒的时间内完成,但是当然,如果你有一个 40MHz 的微控制器,它可能会超过 100 毫秒左右)
标签: c++ dictionary