File indexing completed on 2024-04-28 05:38:40

0001 #include <QtCore/QSet>
0002 #include <QtCore/QHash>
0003 #include <QtCore/QMap>
0004 #include <QtCore/QList>
0005 #include <QtCore/QVector>
0006 
0007 void test()
0008 {
0009     QSet<int> set;
0010     QMap<int,int> map;
0011     QHash<int,int> hash;
0012     QList<int> list;
0013     QVector<int> vec;
0014 
0015     vec.toList().count(); // Warning
0016     map.values()[0]; // Warning
0017     int a = hash.keys().at(0); // Warning
0018     a = map.keys().at(0); // Warning
0019     list.toVector().size(); // Warning
0020 }
0021 
0022 void testRangeLoop()
0023 {
0024     QHash<int,int> hash;
0025     for (auto i : hash.values()) {} // Warning
0026     for (auto i : hash.keys()) {} // Warning
0027     for (auto i : hash) {} // OK
0028     foreach (auto i, hash.keys()) {} // Warning
0029     foreach (auto i, hash.values()) {} // Warning
0030     foreach (auto i, hash) {} // OK
0031 }