[ 1578529 ] better docs for reference-counted objects

This already includes the change for wxBitmap, which
  is not COW yet.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-10-18 17:23:42 +00:00
parent 15d4b8cdb5
commit a91225b27b
12 changed files with 37 additions and 55 deletions

View File

@@ -167,20 +167,8 @@ vastly better from a performance point of view than a wxObjectArray of wxStrings
\subsection{Reference counting and why you shouldn't care about it}\label{wxstringrefcount}
wxString objects use a technique known as {\it copy on write} (COW). This means
that when a string is assigned to another, no copying really takes place: only
the reference count on the shared string data is incremented and both strings
share the same data.
But as soon as one of the two (or more) strings is modified, the data has to be
copied because the changes to one of the strings shouldn't be seen in the
others. As data copying only happens when the string is written to, this is
known as COW.
What is important to understand is that all this happens absolutely
transparently to the class users and that whether a string is shared or not is
not seen from the outside of the class - in any case, the result of any
operation on it is the same.
All considerations for wxObject-derived \helpref{reference counted}{trefcount} objects
are valid also for wxString, even if it does not derive from wxObject.
Probably the unique case when you might want to think about reference
counting is when a string character is taken from a string which is not a