c++ stl 有没有无重复元素队列这样的容器?
大家讲道理
大家讲道理 2017-04-17 13:13:01
0
4
974

c++ stl 有没有无重复元素队列这样的容器 ?

我用unordered_set试过是可以的,就是不知道还有没有其他符合这种特性的容器。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
洪涛

You need a queue and no duplication, so you have to index it yourself, so you need to use two containers together. You can consider queue + set/unordered_set. When inserting an object, first check whether the object is in the set. If it is, it will fail. If it is not, it will be added to both containers at the same time. Do the opposite when popping out.

Peter_Zhu

use {vector/deque/list} + {set/unordered_set}

大家讲道理

A single container cannot satisfy, but you can achieve it yourself. You need to look at the usage scenarios to decide how to implement drunkenness appropriately,

洪涛

No. Let me know what scene you need.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template