介绍
Qt提供的一个单值的数学集合的快速查找容器,使用方式与QList相同,但其内元素不会有重复。详细说明见 官方文档
注意,此容器实现方式是基于哈希表,而不是红黑树,若使用自定义类必须提供对应的hash函数:
QSet‘s value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide
operator==()
, and there must also be a global qHash() function that returns a hash value for an argument of the key’s type. See the QHash documentation