Important: Please read the Qt Code of Conduct -

Right way to store objects in container. How?

  • Hello all!
    I need to store objects in container and after it to get access to them by some id. Therefore the questions:

    • What kind of container is better to use associative QHash/QMap or sequence QList/QVector if none of them then is there are some kind of special container in Qt for storing objects?
    • Is there better to store pointers to objects but not objects itself in container?
    • If it is the sequence containers what technique is better to use for accessing to particular object?

  • Lifetime Qt Champion


    What kind of objects do you have in mind ?

Log in to reply