gpt4 book ai didi

c++ - map 的替代品

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:03:11 25 4
gpt4 key购买 nike

因为 map 不允许重复值。 C++ 标准库中是否有任何其他容器允许通过键值对存储值的重复项?

最佳答案

您可以使用 std::multimap

Multimap is a Sorted Associative Container that associates objects of type Key with objects of type Data. multimap is a Pair Associative Container, meaning that its value type is pair. It is also a Multiple Associative Container, meaning that there is no limit on the number of elements with the same key.

关于c++ - map 的替代品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3190962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com