QMap但没有按键排序 [英] QMap but without sorting by key

查看:751
本文介绍了QMap但没有按键排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要结构像QMap但没有排序的键,所以如果我插入项目,我首先可以计算,这个项目将在所有其他人之前。并在指定元素之前或之后插入对。 Qt有没有这样的?

解决方案

QMap 这意味着插入订单重要。您似乎正在寻找队列。但是,如果你需要一个可以在插入顺序中迭代并且通过特定键访问的容器,那么Qt就没有这样的结构。



这些可以帮助您:





  • 根据插入序列对地图项进行排序

  • ul>

    I need structure like QMap but without sorting on keys, so if I insert item there first I can count that this item will be before all others. And insert pair before or after specified element. Does Qt have such?

    解决方案

    QMap is implemented as a tree, which means that the insertion order does not matter. It appears that you are looking for a queue. However, if you need a container which can be iterated in both insertion order and at the same time accessed through a specific key, then Qt has no such structure for you.

    These could help you:

    这篇关于QMap但没有按键排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆