找回密码
 立即注册
收起左侧

QMultiMap类的insert()和insertMulti()没啥区别吧???

2
回复
9888
查看
[复制链接]
累计签到:120 天
连续签到:1 天
来源: 2018-1-1 09:25:42 显示全部楼层 |阅读模式
1Qter豆
QMultiMap类的insert()和insertMulti()没啥区别吧???如题,实践中发现这俩在QMultiMap类中混用都可以,帮助文档讲的都是QMap中的(这俩函数是QMultiMap类从QMap继承来的,肯定重新定义了,但是官方文档只有QMap类的相关函数介绍,肯定和QMultiMap不一样啊!!!),求解答!!!

回复

使用道具 举报

累计签到:955 天
连续签到:1 天
2018-1-2 08:21:44 显示全部楼层
没什么区别,insertmulti方法是为了QMap中也可以插入相同key的数据。
回复

使用道具 举报

累计签到:25 天
连续签到:1 天
2018-1-2 14:00:13 显示全部楼层
wdmxtk002 发表于 2018-1-2 08:21
没什么区别,insertmulti方法是为了QMap中也可以插入相同key的数据。

QMap:
If there is already an item with the key key, that item's value is replaced with value.
If there are multiple items with the key key, the most recently inserted item's value is replaced with value.

QMultiMap:
If there is already an item with the same key in the map, this function will simply create a new one.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了