QMultiHash 類

模闆 <typename Key, typename T> 類 QMultiHash

The QMultiHash class provides a multi-valued hash table. 更多...

頭: #include <QMultiHash>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

此類 相等可比較 .

注意: 此類的所有函數 可重入 .

公共類型

class const_iterator
class iterator
class key_iterator
const_key_value_iterator
key_value_iterator

公共函數

QMultiHash ()
QMultiHash (const QHash<Key, T> & other )
QMultiHash (std::initializer_list<std::pair<Key, T>> list )
QMultiHash (InputIterator begin , InputIterator end )
(從 6.4 起) auto asKeyValueRange () &&
(從 6.4 起) auto asKeyValueRange () &
(從 6.4 起) auto asKeyValueRange () const &&
(從 6.4 起) auto asKeyValueRange () const &
QMultiHash<Key, T>::iterator begin ()
QMultiHash<Key, T>::const_iterator begin () const
QMultiHash<Key, T>::const_iterator cbegin () const
QMultiHash<Key, T>::const_iterator cend () const
void clear ()
QMultiHash<Key, T>::const_iterator constBegin () const
QMultiHash<Key, T>::const_iterator constEnd () const
QMultiHash<Key, T>::const_iterator constFind (const Key & key , const T & value ) const
QMultiHash<Key, T>::const_key_value_iterator constKeyValueBegin () const
QMultiHash<Key, T>::const_key_value_iterator constKeyValueEnd () const
bool contains (const Key & key , const T & value ) const
qsizetype count (const Key & key , const T & value ) const
QMultiHash<Key, T>::iterator emplace (Key && key , Args &&... args )
QMultiHash<Key, T>::iterator emplace (const Key & key , Args &&... args )
QMultiHash<Key, T>::iterator emplaceReplace (Key && key , Args &&... args )
QMultiHash<Key, T>::iterator emplaceReplace (const Key & key , Args &&... args )
QMultiHash<Key, T>::iterator end ()
QMultiHash<Key, T>::const_iterator end () const
std::pair<QMultiHash<Key, T>::iterator, QMultiHash<Key, T>::iterator> equal_range (const Key & key )
std::pair<QMultiHash<Key, T>::const_iterator, QMultiHash<Key, T>::const_iterator> equal_range (const Key & key ) const
QMultiHash<Key, T>::iterator erase (QMultiHash<Key, T>::const_iterator pos )
QMultiHash<Key, T>::iterator find (const Key & key , const T & value )
QMultiHash<Key, T>::const_iterator find (const Key & key , const T & value ) const
QMultiHash<Key, T>::iterator insert (const Key & key , const T & value )
Key key (const T & value ) const
Key key (const T & value , const Key & defaultKey ) const
QMultiHash<Key, T>::key_iterator keyBegin () const
QMultiHash<Key, T>::key_iterator keyEnd () const
QMultiHash<Key, T>::key_value_iterator keyValueBegin ()
QMultiHash<Key, T>::const_key_value_iterator keyValueBegin () const
QMultiHash<Key, T>::key_value_iterator keyValueEnd ()
QMultiHash<Key, T>::const_key_value_iterator keyValueEnd () const
QList<Key> keys () const
qsizetype remove (const Key & key )
qsizetype remove (const Key & key , const T & value )
(從 6.1 起) qsizetype removeIf (Predicate pred )
QMultiHash<Key, T>::iterator replace (const Key & key , const T & value )
void swap (QMultiHash<Key, T> & other )
T take (const Key & key )
QList<Key> uniqueKeys () const
(從 6.0 起) QMultiHash<Key, T> & unite (const QHash<Key, T> & other )
QMultiHash<Key, T> & unite (const QMultiHash<Key, T> & other )
T value (const Key & key ) const
T value (const Key & key , const T & defaultValue ) const
QList<T> () const
QList<T> (const Key & key ) const
QMultiHash<Key, T> operator+ (const QMultiHash<Key, T> & other ) const
QMultiHash<Key, T> & operator+= (const QMultiHash<Key, T> & other )
T & operator[] (const Key & key )
(從 6.1 起) qsizetype erase_if (QMultiHash<Key, T> & hash , Predicate pred )
size_t qHash (const QMultiHash<Key, T> & key , size_t seed = 0)
bool operator!= (const QMultiHash<Key, T> & lhs , const QMultiHash<Key, T> & rhs )
QDataStream & operator<< (QDataStream & out , const QMultiHash<Key, T> & hash )
bool operator== (const QMultiHash<Key, T> & lhs , const QMultiHash<Key, T> & rhs )
QDataStream & operator>> (QDataStream & in , QMultiHash<Key, T> & hash )

詳細描述

QMultiHash<Key, T> 是一種 Qt 一般 容器類 . It provides a hash table that allows multiple values for the same key.

QMultiHash mostly mirrors QHash 's API. For example, you can use isEmpty() to test whether the hash is empty, and you can traverse a QMultiHash using QHash 的迭代器類 (例如: QHashIterator ). But opposed to QHash , it provides an insert () function that allows the insertion of multiple items with the same key. The replace () function corresponds to QHash::insert (). It also provides convenient operator+() and operator+=().

不像 QMultiMap , QMultiHash does not provide ordering of the inserted items. The only guarantee is that items that share the same key will appear consecutively, from the most recently to the least recently inserted value.

範例:

QMultiHash<QString, int> hash1, hash2, hash3;
hash1.insert("plenty", 100);
hash1.insert("plenty", 2000);
// hash1.size() == 2
hash2.insert("plenty", 5000);
// hash2.size() == 1
hash3 = hash1 + hash2;
// hash3.size() == 3
					

不像 QHash , QMultiHash provides no operator[]. Use value () 或 replace () if you want to access the most recently inserted item with a certain key.

If you want to retrieve all the values for a single key, you can use values(const Key &key), which returns a QList <T>:

QList<int> values = hash.values("plenty");
for (auto i : std::as_const(values))
    cout << i << endl;
					

The items that share the same key are available from most recently to least recently inserted.

A more efficient approach is to call find () to get the STL-style iterator for the first item with a key and iterate from there:

auto i = hash.constFind("plenty");
while (i != hash.cend() && i.key() == "plenty") {
    cout << i.value() << endl;
    ++i;
}
					

QMultiHash's key and value data types must be 可賦值數據類型 。例如,無法存儲 QWidget 作為值;取而代之,存儲 QWidget *. In addition, QMultiHash's key type must provide operator==(), and there must also be a qHash () function in the type's namespace that returns a hash value for an argument of the key's type. See the QHash 文檔編製瞭解細節。

另請參閱 QHash , QHashIterator , QMutableHashIterator ,和 QMultiMap .

成員類型文檔編製

QMultiHash:: const_key_value_iterator

The QMultiHash::const_key_value_iterator typedef provides an STL-style const iterator for QMultiHash .

QMultiHash::const_key_value_iterator is essentially the same as QMultiHash::const_iterator with the difference that operator*() returns a key/value pair instead of a value.

另請參閱 QKeyValueIterator .

QMultiHash:: key_value_iterator

The QMultiHash::key_value_iterator typedef provides an STL-style iterator for QMultiHash .

QMultiHash::key_value_iterator is essentially the same as QMultiHash::iterator with the difference that operator*() returns a key/value pair instead of a value.

另請參閱 QKeyValueIterator .

成員函數文檔編製

template <typename... Args> QMultiHash < Key , T > ::iterator QMultiHash:: emplace ( Key && key , Args &&... args )

template <typename... Args> QMultiHash < Key , T > ::iterator QMultiHash:: emplace (const Key & key , Args &&... args )

Inserts a new element into the container. This new element is constructed in-place using args as the arguments for its construction.

If there is already an item with the same key in the hash, this function will simply create a new one. (This behavior is different from replace (), which overwrites the value of an existing item.)

Returns an iterator pointing to the new element.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 insert .

template <typename... Args> QMultiHash < Key , T > ::iterator QMultiHash:: emplaceReplace ( Key && key , Args &&... args )

template <typename... Args> QMultiHash < Key , T > ::iterator QMultiHash:: emplaceReplace (const Key & key , Args &&... args )

Inserts a new element into the container. This new element is constructed in-place using args as the arguments for its construction.

If there is already an item with the same key in the hash, that item's value is replaced with a value constructed from args .

Returns an iterator pointing to the new element.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 replace and emplace .

[noexcept] T QMultiHash:: value (const Key & key ) const

[noexcept] T QMultiHash:: value (const Key & key , const T & defaultValue ) const

返迴值關聯 key .

若哈希包含的項不具有 key ,函數返迴 defaultValue ,或 默認構造值 若未供給此參數。

If there are multiple items for the key in the hash, the value of the most recently inserted one is returned.

[noexcept] Key QMultiHash:: key (const T & value ) const

[noexcept] Key QMultiHash:: key (const T & value , const Key & defaultKey ) const

Returns the first key mapped to value . If the hash contains no item mapped to value ,返迴 defaultKey ,或 default-constructed key 若未供給此參數。

此函數可能很慢 ( 綫性時間 ),因為 QMultiHash 's internal data structure is optimized for fast lookup by key, not by value.

[since 6.4] auto QMultiHash:: asKeyValueRange () &

[since 6.4] auto QMultiHash:: asKeyValueRange () &&

[since 6.4] auto QMultiHash:: asKeyValueRange () const &

[since 6.4] auto QMultiHash:: asKeyValueRange () const &&

Returns a range object that allows iteration over this hash as key/value pairs. For instance, this range object can be used in a range-based for loop, in combination with a structured binding declaration:

QMultiHash<QString, int> hash;
hash.insert("January", 1);
hash.insert("February", 2);
// ...
hash.insert("December", 12);
for (auto [key, value] : hash.asKeyValueRange()) {
    cout << qPrintable(key) << ": " << value << endl;
    --value; // convert to JS month indexing
}
					

Note that both the key and the value obtained this way are references to the ones in the hash. Specifically, mutating the value will modify the hash itself.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

These functions were introduced in Qt 6.4.

另請參閱 QKeyValueIterator .

[noexcept] QMultiHash:: QMultiHash ()

構造空哈希。

[explicit] QMultiHash:: QMultiHash (const QHash < Key , T > & other )

構造副本為 other (which can be a QHash or a QMultiHash).

QMultiHash:: QMultiHash ( std::initializer_list < std::pair < Key , T >> list )

Constructs a multi-hash with a copy of each of the elements in the initializer list list .

template <typename InputIterator> QMultiHash:: QMultiHash ( InputIterator begin , InputIterator end )

Constructs a multi-hash with a copy of each of the elements in the iterator range [ begin , end ). Either the elements iterated by the range must be objects with first and second data members (like std::pair ), convertible to Key and to T respectively; or the iterators must have key() and value() member functions, returning a key convertible to Key and a value convertible to T 分彆。

QMultiHash < Key , T > ::iterator QMultiHash:: begin ()

返迴 STL 樣式迭代器 指嚮哈希中的首項。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 constBegin () 和 end ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: begin () const

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

這是重載函數。

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: cbegin () const

返迴常量 STL 樣式迭代器 指嚮哈希中的首項。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 begin () 和 cend ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: cend () const

返迴常量 STL 樣式迭代器 pointing to the imaginary item after the last item in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 cbegin () 和 end ().

[noexcept(...)] void QMultiHash:: clear ()

移除哈希的所有項,並釋放它所使用的所有內存。

注意: This function is noexcept when std::is_nothrow_destructible<Node>::value is true .

另請參閱 remove ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: constBegin () const

返迴常量 STL 樣式迭代器 指嚮哈希中的首項。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 begin () 和 constEnd ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: constEnd () const

返迴常量 STL 樣式迭代器 pointing to the imaginary item after the last item in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 constBegin () 和 end ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: constFind (const Key & key , const T & value ) const

返迴迭代器指嚮的項具有 keyvalue 在哈希中。

If the hash contains no such item, the function returns constEnd ().

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

[noexcept] QMultiHash < Key , T > ::const_key_value_iterator QMultiHash:: constKeyValueBegin () const

返迴常量 STL 樣式迭代器 指嚮第一哈希條目。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyValueBegin ().

[noexcept] QMultiHash < Key , T > ::const_key_value_iterator QMultiHash:: constKeyValueEnd () const

返迴常量 STL 樣式迭代器 pointing to the imaginary entry after the last entry in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 constKeyValueBegin ().

[noexcept] bool QMultiHash:: contains (const Key & key , const T & value ) const

返迴 true 若哈希包含的項具有 key and value ;否則返迴 false .

另請參閱 count ().

[noexcept] qsizetype QMultiHash:: count (const Key & key , const T & value ) const

Returns the number of items with the key and value .

另請參閱 contains ().

[noexcept] QMultiHash < Key , T > ::iterator QMultiHash:: end ()

返迴 STL 樣式迭代器 pointing to the imaginary item after the last item in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 begin () 和 constEnd ().

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: end () const

這是重載函數。

std::pair < QMultiHash < Key , T > ::iterator , QMultiHash < Key , T > ::iterator > QMultiHash:: equal_range (const Key & key )

Returns a pair of iterators delimiting the range of values [first, second) , that are stored under key . If the range is empty then both iterators will be equal to end ().

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

[noexcept] std::pair < QMultiHash < Key , T > ::const_iterator , QMultiHash < Key , T > ::const_iterator > QMultiHash:: equal_range (const Key & key ) const

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

這是重載函數。

QMultiHash < Key , T > ::iterator QMultiHash:: erase ( QMultiHash < Key , T > ::const_iterator pos )

Removes the (key, value) pair associated with the iterator pos from the hash, and returns an iterator to the next item in the hash.

此函數從不會導緻 QMultiHash to rehash its internal data structure. This means that it can safely be called while iterating, and won't affect the order of items in the hash. For example:

QMultiHash<QObject *, int> objectHash;
...
QMultiHash<QObject *, int>::iterator i = objectHash.find(obj);
while (i != objectHash.end() && i.key() == obj) {
    if (i.value() == 0) {
        i = objectHash.erase(i);
    } else {
        ++i;
    }
}
					

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 remove (), take (),和 find ().

QMultiHash < Key , T > ::iterator QMultiHash:: find (const Key & key , const T & value )

返迴迭代器指嚮的項具有 key and value . If the hash contains no such item, the function returns end ().

If the hash contains multiple items with the key and value , the iterator returned points to the most recently inserted item.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

[noexcept] QMultiHash < Key , T > ::const_iterator QMultiHash:: find (const Key & key , const T & value ) const

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

這是重載函數。

QMultiHash < Key , T > ::iterator QMultiHash:: insert (const Key & key , const T & value )

插入新項具有 key 和值 value .

If there is already an item with the same key in the hash, this function will simply create a new one. (This behavior is different from replace (), which overwrites the value of an existing item.)

Returns an iterator pointing to the new element.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 replace ().

[noexcept] QMultiHash < Key , T > ::key_iterator QMultiHash:: keyBegin () const

返迴常量 STL 樣式迭代器 指嚮哈希中的第 1 個 Key。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyEnd ().

[noexcept] QMultiHash < Key , T > ::key_iterator QMultiHash:: keyEnd () const

返迴常量 STL 樣式迭代器 pointing to the imaginary item after the last key in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyBegin ().

[noexcept] QMultiHash < Key , T > ::key_value_iterator QMultiHash:: keyValueBegin ()

返迴 STL 樣式迭代器 指嚮第一哈希條目。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyValueEnd ().

[noexcept] QMultiHash < Key , T > ::const_key_value_iterator QMultiHash:: keyValueBegin () const

返迴常量 STL 樣式迭代器 指嚮第一哈希條目。

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyValueEnd ().

[noexcept] QMultiHash < Key , T > ::key_value_iterator QMultiHash:: keyValueEnd ()

返迴 STL 樣式迭代器 pointing to the imaginary entry after the last entry in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyValueBegin ().

[noexcept] QMultiHash < Key , T > ::const_key_value_iterator QMultiHash:: keyValueEnd () const

返迴常量 STL 樣式迭代器 pointing to the imaginary entry after the last entry in the hash.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 keyValueBegin ().

QList < Key > QMultiHash:: keys () const

Returns a list containing all the keys in the hash, in an arbitrary order. Keys that occur multiple times in the hash also occur multiple times in the list.

The order is guaranteed to be the same as that used by ().

此函數創建新列錶,按 綫性時間 . The time and memory use that entails can be avoided by iterating from keyBegin () 到 keyEnd ().

另請參閱 () 和 key ().

qsizetype QMultiHash:: remove (const Key & key )

Removes all the items that have the key from the hash. Returns the number of items removed.

另請參閱 remove (const Key &key, const T &value).

qsizetype QMultiHash:: remove (const Key & key , const T & value )

Removes all the items that have the key and the value value from the hash. Returns the number of items removed.

另請參閱 remove ().

[since 6.1] template <typename Predicate> qsizetype QMultiHash:: removeIf ( Predicate pred )

Removes all elements for which the predicate pred returns true from the multi hash.

The function supports predicates which take either an argument of type QMultiHash<Key, T>::iterator , or an argument of type std::pair<const Key &, T &> .

Returns the number of elements removed, if any.

該函數在 Qt 6.1 引入。

另請參閱 clear () 和 take ().

QMultiHash < Key , T > ::iterator QMultiHash:: replace (const Key & key , const T & value )

插入新項具有 key 和值 value .

If there is already an item with the key , that item's value is replaced with value .

If there are multiple items with the key , the most recently inserted item's value is replaced with value .

Returns an iterator pointing to the new/updated element.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 insert ().

[noexcept] void QMultiHash:: swap ( QMultiHash < Key , T > & other )

Swaps this multi-hash with other 。此操作很快且從不失敗。

T QMultiHash:: take (const Key & key )

Removes the item with the key from the hash and returns the value associated with it.

If the item does not exist in the hash, the function simply returns a 默認構造值 . If there are multiple items for key in the hash, only the most recently inserted one is removed.

若不使用返迴值, remove () 效率更高。

另請參閱 remove ().

QList < Key > QMultiHash:: uniqueKeys () const

Returns a list containing all the keys in the map. Keys that occur multiple times in the map occur only once in the returned list.

另請參閱 keys () 和 ().

[since 6.0] QMultiHash < Key , T > &QMultiHash:: unite (const QHash < Key , T > & other )

Inserts all the items in the other hash into this hash and returns a reference to this hash.

該函數在 Qt 6.0 引入。

另請參閱 insert ().

QMultiHash < Key , T > &QMultiHash:: unite (const QMultiHash < Key , T > & other )

Inserts all the items in the other hash into this hash and returns a reference to this hash.

另請參閱 insert ().

QList < T > QMultiHash:: () const

Returns a list containing all the values in the hash, in an arbitrary order. If a key is associated with multiple values, all of its values will be in the list, and not just the most recently inserted one.

The order is guaranteed to be the same as that used by keys ().

此函數創建新列錶,按 綫性時間 . The time and memory use that entails can be avoided by iterating from keyValueBegin () 到 keyValueEnd ().

另請參閱 keys () 和 value ().

QList < T > QMultiHash:: (const Key & key ) const

Returns a list of all the values associated with the key , from the most recently inserted to the least recently inserted.

這是重載函數。

另請參閱 count () 和 insert ().

QMultiHash < Key , T > QMultiHash:: operator+ (const QMultiHash < Key , T > & other ) const

Returns a hash that contains all the items in this hash in addition to all the items in other . If a key is common to both hashes, the resulting hash will contain the key multiple times.

另請參閱 operator+= ().

QMultiHash < Key , T > &QMultiHash:: operator+= (const QMultiHash < Key , T > & other )

Inserts all the items in the other hash into this hash and returns a reference to this hash.

另請參閱 unite () 和 insert ().

T &QMultiHash:: operator[] (const Key & key )

返迴值關聯 key 作為可修改引用。

若哈希包含的項不具有 key , the function inserts a 默認構造值 into the hash with the key , and returns a reference to it.

If the hash contains multiple items with the key , this function returns a reference to the most recently inserted value.

警告: Returned iterators/references should be considered invalidated the next time you call a non-const function on the hash, or when the hash is destroyed.

另請參閱 insert () 和 value ().

相關非成員

[since 6.1] template <typename Key, typename T, typename Predicate> qsizetype erase_if ( QMultiHash < Key , T > & hash , Predicate pred )

Removes all elements for which the predicate pred returns true from the multi hash hash .

The function supports predicates which take either an argument of type QMultiHash<Key, T>::iterator , or an argument of type std::pair<const Key &, T &> .

Returns the number of elements removed, if any.

該函數在 Qt 6.1 引入。

[noexcept(...)] template <typename Key, typename T> size_t qHash (const QMultiHash < Key , T > & key , size_t seed = 0)

返迴哈希值為 key ,使用 seed 做計算種子。

類型 Key and T must be supported by qHash().

注意: This function is noexcept when noexcept(qHash(std::declval<Key&>())) && noexcept(qHash(std::declval<T&>())) is true .

[noexcept] bool operator!= (const QMultiHash < Key , T > & lhs , const QMultiHash < Key , T > & rhs )

返迴 true if lhs multihash is not equal to the rhs multihash; otherwise returns false .

Two multihashes are considered equal if they contain the same (key, value) pairs.

This function requires the value type to implement operator==() .

另請參閱 operator== ().

template <typename Key, typename T> QDataStream & operator<< ( QDataStream & out , const QMultiHash < Key , T > & hash )

寫入哈希 hash 到流 out .

This function requires the key and value types to implement operator<<() .

另請參閱 序列化 Qt 數據類型 .

[noexcept] bool operator== (const QMultiHash < Key , T > & lhs , const QMultiHash < Key , T > & rhs )

返迴 true if lhs multihash equals to the rhs multihash; otherwise returns false .

Two multihashes are considered equal if they contain the same (key, value) pairs.

This function requires the value type to implement operator==() .

另請參閱 operator!= ().

template <typename Key, typename T> QDataStream & operator>> ( QDataStream & in , QMultiHash < Key , T > & hash )

讀取哈希從流 in into hash .

This function requires the key and value types to implement operator>>() .

另請參閱 序列化 Qt 數據類型 .