File: multi_containers.cpp

package info (click to toggle)
clazy 1.17-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 5,248 kB
  • sloc: cpp: 23,552; python: 1,450; xml: 450; sh: 237; makefile: 46
file content (25 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <QtCore/QMap>
#include <QtCore/QHash>

QMap<int,int> getMap() { return {}; }
QMultiMap<int,int> getMultiMap() { return {}; }
void testDerivedClass()
{
    getMultiMap().begin(); // Warning
    getMultiMap().insert(1, 1); // Warning
}

void maps()
{
    QMap<int, QStringList> map;
    map.value(0).first(); // OK for Qt5, value() returns const T
    map[0].removeAll("asd"); // OK
    map.values().first(); // OK, QMap::values() isn't shared
    getMap().keyValueBegin(); // Warning
}
void test_ctor()
{
    QStringList().first();
    QByteArray key = "key";
    QByteArray(key + key).data(); // In Qt5, this is const
}