Can a QString be shared between two Qt containers without being deep-copied?

37 views Asked by At

Say I have the code below.

    QSet<QString> set;
    QList<QString> list;
    QString str("hello");

    set.insert(str);
    list.append(str);

Question: Is the QString deep-copied into the two containers, or is the QString now shared among the three variables (i.e., a single copy of "hello" in the QString with a reference count of 3)?

0

There are 0 answers