Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Inserting value in the list of QPair
-
Hello All,
Currently i am using a QList of QPair as below:
QList<QPair<char,int>> sample;
I have appended 15 values(for eg.) in the list and now i want to insert or change only the second
element of the QPair at a given index.
Current syntax: sample.insert(6,{'J',65});
What would be the way to change the element at the second position.
-
Take a lookt at QList::operator[]
btw: why do you use a list instead a vector here?
-
@Christian-Ehrlicher : Is using vector more sutaible for my current requirement ?
Please suggest :)
-
Since I don't know what you're doing please read https://doc.qt.io/qt-5/containers.html
-
@Christian-Ehrlicher : Ok thanks.