Hi, I've got 3 variables (string, int, int) and I have to put it into contrainer and can get int value by entering key
I used QPair but it not provides to take value by key
I don't know how to explain it, look at my code should be easier
int key = 2;
int key_2 = 5;
int key_3 = 3;
int value = 4;
int value_2 = 0;
int value_3 = 9;
cont[name].push_back(qMakePair(key,value));
cont[name].push_back(qMakePair(key_2,value_2));
cont[name_2].push_back(qMakePair(value_3,key_3));
qDebug() << cont;
QHash <QString, QVector <QPair <int, int>> > cont;
QString name = "name";
QString name_2 = "name2";
int key = 2;
int key_2 = 5;
int key_3 = 3;
int value = 4;
int value_2 = 0;
int value_3 = 9;
cont[name].push_back(qMakePair(key,value));
cont[name].push_back(qMakePair(key_2,value_2));
cont[name_2].push_back(qMakePair(value_3,key_3));
qDebug() << cont;
To copy to clipboard, switch view to plain text mode
qDebug output to see structure
QHash(("name2", QVector(QPair(9,3)))("name", QVector(QPair(2,4), QPair(5,0))))
To copy to clipboard, switch view to plain text mode
So I want to get value when I will compare string and put key number
Any idea ?
Regards
Bookmarks