On 27/04/12 00:45, Scott Aron Bloom wrote: > Nope. That was not the issue. The issue was that when you append list > A into list B, you can't get to list A because what's inside list B is a > copy of A, not A itself. You might want to read again from the first > post. > > _______________________________________________ > > Nope.. not at all.. > > The problem is with your testcase Nikos... NOT implicit sharing.. > > listOfInts.append(10); > > Expliticly PREVENTS the modification of the listOfInts variable. > > It takes in a const object reference, Guarenteeing the original will NOT > be modified.. And implying that any modification to the original will > not effect the copy as well..
I said: list->append(&someOtherList); You said: If someOtherList goes out of scope, you will be pointing to a deleted list. Since QList uses implicit sharing, the cost of removing the inner pointer isn't that much. QList< QList< int > > Is much safer. I said: Note that with QList< QList<int> > you can't modify the other lists. You'd only be modifying the copies. You said: Not true at all.. I don't see what it is that we're discussing here. Your statement was simply wrong. My suggestion to be able to modify the other list: list->append(&someOtherList); Your suggestion to be able to modify the other list: list->append(someOtherList); which doesn't work. You will *not* be able to modify 'someOtherList' through 'list'. It's basic C++. You *need* to hold a pointer, or else you're dealing with a copy. Whether that copy uses implicit sharing doesn't matter at all; implicit sharing is just an optimization. _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest