IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QMultiMap Class

The https:// class is a template class that provides an associative array with multiple equivalent keys.

All functions in this class are https://.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QMultiMap Class▲

  • Header: QMultiMap

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Core)

    target_link_libraries(mytarget PRIVATE Qt6::Core)

  • qmake: QT += core

  • Group: QMultiMap is part of tools, https://

Detailed Description▲

https://<Key, T> is one of Qt's generic https://. It stores (key, value) pairs and provides fast lookup by key.

https:// and https:// provide very similar functionality. The differences are:

  • https:// provides average faster lookups than https://. (See https:// for details.)

  • When iterating over a https://, the items are arbitrarily ordered. With https://, the items are always sorted by key.

  • The key type of a https:// must provide operator==() and a global https://(Key) function. The key type of a https:// must provide operator<() specifying a total order. Since Qt 5.8.1 it is also safe to use a pointer type as key, even if the underlying operator<() does not provide a total order.

Here's an example https:// with https:// keys and int values:

 
Sélectionnez
QMultiMap&lt;QString, int&gt; multimap;

To insert a (key, value) pair into the multi map, you can use https://():

 
Sélectionnez
multimap.insert("a", 1);
multimap.insert("b", 3);
multimap.insert("c", 7);
multimap.insert("c", -5);

This inserts the following three (key, value) pairs into the https://: ("a", 1), ("b", 3), ("c", 7), and ("c", -5); note that duplicate keys are allowed.

To look up a value, use https://() or https://():

 
Sélectionnez
int num2 = multimap.value("a"); // 1
int num3 = multimap.value("thirteen"); // not found; 0
int num3 = 0;
auto it = multimap.value("b");
if (it != multimap.end()) {
    num3 = it.value();
}

If there is no item with the specified key in the map, these functions return a https://.

If you want to check whether the map contains a certain key, use https://():

 
Sélectionnez
int timeout = 30;
if (multimap.contains("TIMEOUT"))
    timeout = multimap.value("TIMEOUT");

// better:
auto it = multimap.find("TIMEOUT");
if (it != multimap.end())
    timeout = it.value();

There is also a https://() overload that uses its second argument as a default value if there is no item with the specified key:

 
Sélectionnez
int timeout = multimap.value("TIMEOUT", 30);

If you want to navigate through all the (key, value) pairs stored in a https://, you can use an iterator. https:// provides both https:// (https:// and https://) and https:// (https:// and https://). Here's how to iterate over a https://<https://, int> using a Java-style iterator:

 
Sélectionnez
QMultiMapIterator&lt;QString, int&gt; i(multimap);
while (i.hasNext()) {
    i.next();
    cout &lt;&lt; i.key() &lt;&lt; ": " &lt;&lt; i.value() &lt;&lt; Qt::endl;
}

Here's the same code, but using an STL-style iterator this time:

 
Sélectionnez
auto i = multimap.constBegin();
while (i != multimap.constEnd()) {
    cout &lt;&lt; i.key() &lt;&lt; ": " &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}

The items are traversed in ascending key order.

A https:// allows multiple values per key. If you call https://() with a key that already exists in the map, a new (key, value) pair will be inserted. For example:

 
Sélectionnez
multimap.insert("plenty", 100);
multimap.insert("plenty", 2000);
// multimap.size() == 2

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

 
Sélectionnez
QList&lt;int&gt; values = multimap.values("plenty");
for (int i = 0; i &lt; values.size(); ++i)
    cout &lt;&lt; values.at(i) &lt;&lt; Qt::endl;

The items that share the same key are available from most recently to least recently inserted. Another approach is to call https://() to get the STL-style iterator for the first item with a key and iterate from there:

 
Sélectionnez
QMultiMap&lt;QString, int&gt;::iterator i = multimap.find("plenty");
while (i != map.end() &amp;&amp; i.key() == "plenty") {
    cout &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}

// better:
auto [i, end] = multimap.equal_range("plenty");
while (i != end) {
    cout &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}

If you only need to extract the values from a map (not the keys), you can also use https://:

 
Sélectionnez
QMap&lt;QString, int&gt; multimap;
...
foreach (int value, multimap)
    cout &lt;&lt; value &lt;&lt; Qt::endl;

Items can be removed from the multi map in several ways. One way is to call https://(); this will remove any item with the given key. Another way is to use https://(). In addition, you can clear the entire map using https://().

It is possible to merge two multi maps by calling https://(), by using operator+(), and by using operator+=(). Example:

 
Sélectionnez
QMultiMap&lt;QString, int&gt; map1, map2, map3;

map1.insert("plenty", 100);
map1.insert("plenty", 2000);
// map1.size() == 2

map2.insert("plenty", 5000);
// map2.size() == 1

map3 = map1 + map2;
// map3.size() == 3

https://'s key and value data types must be https://. This covers most data types you are likely to encounter, but the compiler won't let you, for example, store a https:// as a value; instead, store a https:// *. In addition, https://'s key type must provide operator<(). https:// uses it to keep its items sorted, and assumes that two keys x and y are equal if neither x < y nor y < x is true.

Example:

 
Sélectionnez
#ifndef EMPLOYEE_H
#define EMPLOYEE_H

class Employee
{
public:
    Employee() {}
    Employee(const QString &amp;name, QDate dateOfBirth);
    ...

private:
    QString myName;
    QDate myDateOfBirth;
};

inline bool operator&lt;(const Employee &amp;e1, const Employee &amp;e2)
{
    if (e1.name() != e2.name())
        return e1.name() &lt; e2.name();
    return e1.dateOfBirth() &lt; e2.dateOfBirth();
}

#endif // EMPLOYEE_H

In the example, we start by comparing the employees' names. If they're equal, we compare their dates of birth to break the tie.

See Also▲

See also https://, https://, https://

Member Type Documentation▲

 

QMultiMap::ConstIterator▲

Qt-style synonym for https://<Key, T>::const_iterator.

QMultiMap::Iterator▲

Qt-style synonym for https://<Key, T>::iterator.

[since 5.10] QMultiMap::const_key_value_iterator▲

The QMultiMap::const_key_value_iterator typedef provides an STL-style iterator for https://.

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

This typedef was introduced in Qt 5.10.

See Also▲

See also https://

[alias] QMultiMap::difference_type▲

Typedef for ptrdiff_t. Provided for STL compatibility.

[alias] QMultiMap::key_type▲

Typedef for Key. Provided for STL compatibility.

[since 5.10] QMultiMap::key_value_iterator▲

The QMultiMap::key_value_iterator typedef provides an STL-style iterator for https://.

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

This typedef was introduced in Qt 5.10.

See Also▲

See also https://

[alias] QMultiMap::mapped_type▲

Typedef for T. Provided for STL compatibility.

[alias] QMultiMap::size_type▲

Typedef for int. Provided for STL compatibility.

Member Function Documentation▲

 

QMultiMap::QMultiMap()▲

Constructs an empty multi map.

See Also▲

See also https://()

[since 5.1] QMultiMap::QMultiMap(std::initializer_list<std::pair<Key, T>> list)▲

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

This function was introduced in Qt 5.1.

[explicit, since 6.0] QMultiMap::QMultiMap(const QMap<Key, T> &other)▲

Constructs a multi map as a copy of other.

This function was introduced in Qt 6.0.

[explicit, since 6.0] QMultiMap::QMultiMap(QMap<Key, T> &&other)▲

If other is shared, constructs a multi map as a copy of other. Otherwise, constructs a multi map by moving the elements from other.

This function was introduced in Qt 6.0.

[explicit] QMultiMap::QMultiMap(const std::multimap<Key, T> &other)▲

Constructs a copy of other.

See Also▲

See also toStdMultiMap()

[explicit] QMultiMap::QMultiMap(std::multimap<Key, T> &&other)▲

Constructs a multi map by moving from other.

See Also▲

See also toStdMultiMap()

[default, since 5.2] QMultiMap::QMultiMap(QMultiMap<Key, T> &&other)▲

Move-constructs a https:// instance, making it point at the same object that other was pointing to.

This function was introduced in Qt 5.2.

[default] QMultiMap::QMultiMap(const QMultiMap<Key, T> &other)▲

Constructs a copy of other.

This operation occurs in https://, because https:// is https://. This makes returning a https:// from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and this takes https://.

See Also▲

See also https://()

[default] QMultiMap::~QMultiMap()▲

Destroys the multi map. References to the values in the multi map, and all iterators over this multi map, become invalid.

QMultiMap::iterator QMultiMap::begin()▲

Returns an https:// pointing to the first item in the multi map.

See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::begin() const▲

This is an overloaded function.

[since 5.0] QMultiMap::const_iterator QMultiMap::cbegin() const▲

Returns a const https:// pointing to the first item in the multi map.

This function was introduced in Qt 5.0.

See Also▲

See also https://(), https://()

[since 5.0] QMultiMap::const_iterator QMultiMap::cend() const▲

Returns a const https:// pointing to the imaginary item after the last item in the multi map.

This function was introduced in Qt 5.0.

See Also▲

See also https://(), https://()

void QMultiMap::clear()▲

Removes all items from the multi map.

See Also▲

See also https://()

QMultiMap::const_iterator QMultiMap::constBegin() const▲

Returns a const https:// pointing to the first item in the multi map.

See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::constEnd() const▲

Returns a const https:// pointing to the imaginary item after the last item in the multi map.

See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::constFind(const Key &key) const▲

Returns an const iterator pointing to the item with key key in the multi map.

If the multi map contains no item with key key, the function returns https://().

See Also▲

See also https://(), QMultiMap::constFind()

QMultiMap::const_iterator QMultiMap::constFind(const Key &key, const T &value) const▲

Returns an iterator pointing to the item with key key and the value value in the map.

If the map contains no such item, the function returns https://().

See Also▲

See also https://()

[since 5.10] QMultiMap::const_key_value_iterator QMultiMap::constKeyValueBegin() const▲

Returns a const https:// pointing to the first entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

[since 5.10] QMultiMap::const_key_value_iterator QMultiMap::constKeyValueEnd() const▲

Returns a const https:// pointing to the imaginary entry after the last entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

bool QMultiMap::contains(const Key &key) const▲

Returns true if the multi map contains an item with key key; otherwise returns false.

See Also▲

See also https://()

bool QMultiMap::contains(const Key &key, const T &value) const▲

Returns true if the multi map contains an item with key key and value value; otherwise returns false.

See Also▲

See also https://()

QMultiMap::size_type QMultiMap::count(const Key &key) const▲

Returns the number of items associated with key key.

See Also▲

See also https://(), https://()

QMultiMap::size_type QMultiMap::count(const Key &key, const T &value) const▲

Returns the number of items with key key and value value.

See Also▲

See also https://(), https://()

QMultiMap::size_type QMultiMap::count() const▲

This is an overloaded function.

Same as https://().

bool QMultiMap::empty() const▲

This function is provided for STL compatibility. It is equivalent to https://(), returning true if the map is empty; otherwise returning false.

QMultiMap::iterator QMultiMap::end()▲

Returns an https:// pointing to the imaginary item after the last item in the multi map.

See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::end() const▲

This is an overloaded function.

QPair<QMultiMap::iterator, QMultiMap::iterator> QMultiMap::equal_range(const Key &key)▲

Returns a pair of iterators delimiting the range of values [first, second), that are stored under key.

[since 5.6] QPair<QMultiMap::const_iterator, QMultiMap::const_iterator> QMultiMap::equal_range(const Key &key) const▲

This is an overloaded function.

This function was introduced in Qt 5.6.

QMultiMap::iterator QMultiMap::erase(QMultiMap::const_iterator pos)▲

Removes the (key, value) pair pointed to by the iterator pos from the multi map, and returns an iterator to the next item in the map.

See Also▲

See also https://()

[since 6.0] QMultiMap::iterator QMultiMap::erase(QMultiMap::const_iterator first, QMultiMap::const_iterator last)▲

Removes the (key, value) pairs pointed to by the iterator range [first, last) from the multi map. Returns an iterator to the item in the multi map following the last removed element.

This function was introduced in Qt 6.0.

See Also▲

See also https://()

QMultiMap::iterator QMultiMap::find(const Key &key)▲

Returns an iterator pointing to the item with key key in the multi map.

If the multi map contains no item with key key, the function returns https://().

If the map contains multiple items with key key, this function returns an iterator that points to the most recently inserted value. The other values are accessible by incrementing the iterator. For example, here's some code that iterates over all the items with the same key:

 
Sélectionnez
QMultiMap&lt;QString, int&gt;::iterator i = multimap.find("plenty");
while (i != map.end() &amp;&amp; i.key() == "plenty") {
    cout &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}

// better:
auto [i, end] = multimap.equal_range("plenty");
while (i != end) {
    cout &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}
See Also▲

See also https://(), https://(), https://(), https://(), https://()

QMultiMap::const_iterator QMultiMap::find(const Key &key) const▲

This is an overloaded function.

QMultiMap::const_iterator QMultiMap::find(const Key &key, const T &value) const▲

This is an overloaded function.

Returns a const iterator pointing to the item with the given key and value in the map.

If the map contains no such item, the function returns https://().

If the map contains multiple items with the specified key, this function returns a const iterator that points to the most recently inserted value.

[since 5.2] T &QMultiMap::first()▲

Returns a reference to the first value in the multi map, that is the value mapped to the smallest key. This function assumes that the multi map is not empty.

When unshared (or const version is called), this executes in https://.

This function was introduced in Qt 5.2.

See Also▲

See also https://(), https://(), https://()

[since 5.2] const T &QMultiMap::first() const▲

This is an overloaded function.

This function was introduced in Qt 5.2.

[since 5.2] const Key &QMultiMap::firstKey() const▲

Returns a reference to the smallest key in the multi map. This function assumes that the multi map is not empty.

This executes in https://.

This function was introduced in Qt 5.2.

See Also▲

See also https://(), https://(), https://(), https://()

QMultiMap::iterator QMultiMap::insert(const Key &key, const T &value)▲

Inserts a new item with the key key and a value of value.

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

See Also▲

See also https://()

[since 5.1] QMultiMap::iterator QMultiMap::insert(QMultiMap::const_iterator pos, const Key &key, const T &value)▲

This is an overloaded function.

Inserts a new item with the key key and value value and with hint pos suggesting where to do the insert.

If https://() is used as hint it indicates that the key is less than any key in the multi map while https://() suggests that the key is (strictly) larger than any key in the multi map. Otherwise the hint should meet the condition (pos - 1).https://() < key <= pos.https://(). If the hint pos is wrong it is ignored and a regular insert is done.

If the hint is correct and the multi map is unshared, the insert executes in amortized https://.

If there is already an item with the same key in the map, this function will simply create a new one.

When creating a multi map from sorted data inserting the largest key first with https://() is faster than inserting in sorted order with https://(), since https://() - 1 (which is needed to check if the hint is valid) needs https://.

Note: Be careful with the hint. Providing an iterator from an older shared instance might crash but there is also a risk that it will silently corrupt both the multi map and the pos multi map.

This function was introduced in Qt 5.1.

bool QMultiMap::isEmpty() const▲

Returns true if the multi map contains no items; otherwise returns false.

See Also▲

See also https://()

Key QMultiMap::key(const T &value, const Key &defaultKey = Key()) const▲

This is an overloaded function.

Returns the first key with value value, or defaultKey if the multi map contains no item with value value. If no defaultKey is provided the function returns a https://.

This function can be slow (https://), because https://'s internal data structure is optimized for fast lookup by key, not by value.

See Also▲

See also https://(), https://()

[since 5.6] QMultiMap::key_iterator QMultiMap::keyBegin() const▲

Returns a const https:// pointing to the first key in the multi map.

This function was introduced in Qt 5.6.

See Also▲

See also https://(), https://()

[since 5.6] QMultiMap::key_iterator QMultiMap::keyEnd() const▲

Returns a const https:// pointing to the imaginary item after the last key in the multi map.

This function was introduced in Qt 5.6.

See Also▲

See also https://(), https://()

[since 5.10] QMultiMap::key_value_iterator QMultiMap::keyValueBegin()▲

Returns an https:// pointing to the first entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

[since 5.10] QMultiMap::const_key_value_iterator QMultiMap::keyValueBegin() const▲

Returns a const https:// pointing to the first entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

[since 5.10] QMultiMap::key_value_iterator QMultiMap::keyValueEnd()▲

Returns an https:// pointing to the imaginary entry after the last entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

[since 5.10] QMultiMap::const_key_value_iterator QMultiMap::keyValueEnd() const▲

Returns a const https:// pointing to the imaginary entry after the last entry in the multi map.

This function was introduced in Qt 5.10.

See Also▲

See also https://()

QList<Key> QMultiMap::keys() const▲

Returns a list containing all the keys in the multi map in ascending order. Keys that occur multiple times in the multi map also occur multiple times in the list.

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

This function creates a new list, in https://. The time and memory use that entails can be avoided by iterating from https://() to https://().

See Also▲

See also https://(), https://()

QList<Key> QMultiMap::keys(const T &value) const▲

This is an overloaded function.

Returns a list containing all the keys associated with value value in ascending order.

This function can be slow (https://), because https://'s internal data structure is optimized for fast lookup by key, not by value.

[since 5.2] T &QMultiMap::last()▲

Returns a reference to the last value in the multi map, that is the value mapped to the largest key. This function assumes that the map is not empty.

When unshared (or const version is called), this executes in https://.

This function was introduced in Qt 5.2.

See Also▲

See also https://(), https://(), https://()

[since 5.2] const T &QMultiMap::last() const▲

This is an overloaded function.

This function was introduced in Qt 5.2.

[since 5.2] const Key &QMultiMap::lastKey() const▲

Returns a reference to the largest key in the multi map. This function assumes that the multi map is not empty.

This executes in https://.

This function was introduced in Qt 5.2.

See Also▲

See also https://(), https://(), https://(), https://()

QMultiMap::iterator QMultiMap::lowerBound(const Key &key)▲

Returns an iterator pointing to the first item with key key in the map. If the map contains no item with key key, the function returns an iterator to the nearest item with a greater key.

Example:

 
Sélectionnez
QMultiMap&lt;int, QString&gt; multimap;
multimap.insert(1, "one");
multimap.insert(5, "five");
multimap.insert(5, "five (2)");
multimap.insert(10, "ten");

multimap.lowerBound(0);      // returns iterator to (1, "one")
multimap.lowerBound(1);      // returns iterator to (1, "one")
multimap.lowerBound(2);      // returns iterator to (5, "five")
multimap.lowerBound(5);      // returns iterator to (5, "five")
multimap.lowerBound(6);      // returns iterator to (10, "ten")
multimap.lowerBound(10);     // returns iterator to (10, "ten")
multimap.lowerBound(999);    // returns end()

If the map contains multiple items with key key, this function returns an iterator that points to the most recently inserted value. The other values are accessible by incrementing the iterator. For example, here's some code that iterates over all the items with the same key:

 
Sélectionnez
QMap&lt;QString, int&gt; multimap;
...
QMap&lt;QString, int&gt;::const_iterator i = multimap.lowerBound("HDR");
QMap&lt;QString, int&gt;::const_iterator upperBound = multimap.upperBound("HDR");
while (i != upperBound) {
    cout &lt;&lt; i.value() &lt;&lt; Qt::endl;
    ++i;
}
See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::lowerBound(const Key &key) const▲

This is an overloaded function.

QMultiMap::size_type QMultiMap::remove(const Key &key)▲

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

See Also▲

See also https://(), https://()

QMultiMap::size_type QMultiMap::remove(const Key &key, const T &value)▲

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

See Also▲

See also https://(), https://()

QMultiMap::iterator QMultiMap::replace(const Key &key, const T &value)▲

Inserts a new item with the key key and a value of value.

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

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

See Also▲

See also https://()

QMultiMap::size_type QMultiMap::size() const▲

Returns the number of (key, value) pairs in the multi map.

See Also▲

See also https://(), https://()

void QMultiMap::swap(QMultiMap<Key, T> &other)▲

Swaps multi map other with this multi map. This operation is very fast and never fails.

T QMultiMap::take(const Key &key)▲

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

If the item does not exist in the multi map, the function simply returns a https://. If there are multiple items for key in the map, only the most recently inserted one is removed and returned.

If you don't use the return value, https://() is more efficient.

See Also▲

See also https://()

QList<Key> QMultiMap::uniqueKeys() const▲

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

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

Inserts all the items in the other map into this map. If a key is common to both maps, the resulting map will contain the key multiple times.

QMultiMap<Key, T> &QMultiMap::unite(QMultiMap<Key, T> &&other)▲

Moves all the items from the other map into this map. If a key is common to both maps, the resulting map will contain the key multiple times.

If other is shared, then the items will be copied instead.

QMultiMap::iterator QMultiMap::upperBound(const Key &key)▲

Returns an iterator pointing to the item that immediately follows the last item with key key in the map. If the map contains no item with key key, the function returns an iterator to the nearest item with a greater key.

Example:

 
Sélectionnez
QMultiMap&lt;int, QString&gt; multimap;
multimap.insert(1, "one");
multimap.insert(5, "five");
multimap.insert(5, "five (2)");
multimap.insert(10, "ten");

multimap.upperBound(0);      // returns iterator to (1, "one")
multimap.upperBound(1);      // returns iterator to (5, "five")
multimap.upperBound(2);      // returns iterator to (5, "five")
multimap.lowerBound(5);      // returns iterator to (5, "five (2)")
multimap.lowerBound(6);      // returns iterator to (10, "ten")
multimap.upperBound(10);     // returns end()
multimap.upperBound(999);    // returns end()
See Also▲

See also https://(), https://()

QMultiMap::const_iterator QMultiMap::upperBound(const Key &key) const▲

This is an overloaded function.

T QMultiMap::value(const Key &key, const T &defaultValue = T()) const▲

Returns the value associated with the key key.

If the multi map contains no item with key key, the function returns defaultValue. If no defaultValue is specified, the function returns a https://. If there are multiple items for key in the multi map, the value of the most recently inserted one is returned.

See Also▲

See also https://(), https://(), https://()

QList<T> QMultiMap::values() const▲

Returns a list containing all the values in the map, in ascending order of their keys. 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.

See Also▲

See also https://(), https://()

QList<T> QMultiMap::values(const Key &key) const▲

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

See Also▲

See also https://(), https://()

[default] QMultiMap<Key, T> &QMultiMap::operator=(const QMultiMap<Key, T> &other)▲

Assigns other to this multi map and returns a reference to this multi map.

[default, since 5.2] QMultiMap<Key, T> &QMultiMap::operator=(QMultiMap<Key, T> &&other)▲

Move-assigns other to this https:// instance.

This function was introduced in Qt 5.2.

Related Non-Members▲

 

QTypeTraits::compare_eq_result<AKey, AT> operator!=(const QMultiMap<Key, T> &lhs, const QMultiMap<Key, T> &rhs)▲

Returns true if lhs is not equal to rhs; otherwise returns false.

Two multi maps are considered equal if they contain the same (key, value) pairs, in the same order (which matters for duplicate keys).

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

See Also▲

See also https://()

QDataStreamIfHasOStreamOperators<Key, T> operator<<(QDataStream &out, const QMultiMap<Key, T> &map)▲

Writes the multi map map to stream out.

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

See Also▲

See also https://

QTypeTraits::compare_eq_result<AKey, AT> operator==(const QMultiMap<Key, T> &lhs, const QMultiMap<Key, T> &rhs)▲

Returns true if lhs is equal to rhs; otherwise returns false.

Two multi maps are considered equal if they contain the same (key, value) pairs, in the same order (which matters for duplicate keys).

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

See Also▲

See also https://()

QDataStreamIfHasIStreamOperators<Key, T> operator>>(QDataStream &in, QMultiMap<Key, T> &map)▲

Reads a map from stream in into map.

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

See Also▲

See also https://

Obsolete Members for QMultiMap▲

The following members of class https:// are deprecated. We strongly advise against using them in new code.

Obsolete Member Function Documentation▲

 
[since 5.15] void QMultiMap::insert(const QMultiMap<Key, T> &map)▲

This function is deprecated. We strongly advise against using it in new code.

Use https://() instead.

Inserts all the items in map into this map.

This function was introduced in Qt 5.15.

[since 5.15] void QMultiMap::insert(QMultiMap<Key, T> &&map)▲

This function is deprecated. We strongly advise against using it in new code.

Use https://() instead.

This is an overloaded function.

Moves all the items from map into this map.

If map is shared, then the items will be copied instead.

This function was introduced in Qt 5.15.

QMultiMap::iterator QMultiMap::insertMulti(const Key &key, const T &value)▲

This function is deprecated. We strongly advise against using it in new code.

Use https://() instead.

Inserts a new item with the key key and a value of value, and returns an iterator pointing to the new item.

QMultiMap::iterator QMultiMap::insertMulti(QMultiMap::const_iterator pos, const Key &key, const T &value)▲

This function is deprecated. We strongly advise against using it in new code.

Use https://() instead.

This is an overloaded function.

Inserts a new item with the key key and value value and with hint pos suggesting where to do the insert.

std::multimap<Key, T> QMultiMap::toStdMap() const▲

This function is deprecated. We strongly advise against using it in new code.

Use toStdMultiMap() instead.

Returns an STL multi map equivalent to this https://.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+   

Ce document est disponible sous la licence https:// telle que publiée par la Free Software Foundation.