STL容器,保留插入顺序,但不允许重复 [英] STL Container that preserves order of insertion but allows no duplicates
本文介绍了STL容器,保留插入顺序,但不允许重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$我正在寻找一个STL容器,该容器保留插入顺序(无排序),但不允许重复。有一个吗?
I am looking for an STL container that preserves order of insertion ( no sorting ) but does not allow duplicates. Is there one? if not any tricks I can use to customize one?
推荐答案
目前没有这样的容器,但是您可以创建通过将 std :: vector
和 std :: set
放在同一个类中以廉价的方式自己创建一个
There is no such a container at the moment, but you can create your own one in a cheap way by holding a std::vector
and a std::set
in a class together.
这篇关于STL容器,保留插入顺序,但不允许重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文