[Qt-interest] QList: Force a deep copy?
Diego Schulz
dschulz at gmail.com
Tue Jun 30 03:52:37 CEST 2009
On Mon, Jun 29, 2009 at 8:10 PM, Scott Aron
Bloom<Scott.Bloom at sabgroup.com> wrote:
> But to answer Eric's original question :) It should be.. If you are at
> QList, there really is no obvious way to know or learn about detach via
> the docs.
>
> I would file a bug in the documentation...
> Scott
>
I think there might be good reasons for not including a reference to
detach() in the QList documentation.
But admittedly, I'm not sure.
Looking at src/corelib/tools/qlist.h (HEAD
@fbfa69a5f71a415dfa9673a6325e0fc0023a2389)
---snip---snip---
66 ...
67 QBasicAtomicInt ref;
68 int alloc, begin, end;
69 uint sharable : 1;
70 void *array[1];
71 };
72 enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
73
74 Data *detach(); // remove in 5.0 <<<<<< look at this
75 Data *detach2();
76 void realloc(int alloc);
77 static Data shared_null;
78 Data *d;
79 void **erase(void **xi);
80 void **append();
81 ...
--- snip --- snip ---
Naive cuestion.. in which circumstances it is necesary to make a deep
copy of an instance of an implicitly shared class?
regards,
diego
More information about the Qt-interest-old
mailing list