lundi 1 février 2016

QMap insert QVector

I want to build up a map of devices such that the map contains:

QString 'DeviceID' and QVector 'Command List'

Currently I have the QMap as follows:

QMap<QString, QVector<QString> *> devices;

QVector<QString> *pCommands= new QVector<QString>;
devices.insert(RadioID, pCommands);

But I am wandering if this is actually any better then:

QMap<QString, QVector<QString>> devices;

QVector<QString> commands;
devices.insert(RadioID, commands);

I am sure that I read somewhere that Qt does something quite efficient when copying data. I am not seeing many people using pointers with Qt and it seems messy that I have to go through the QMap deleting all the QVector's at the end...

I am using c++11, so maybe some kind of move semantic may work here?

Aucun commentaire:

Enregistrer un commentaire