On 22/01/2013 16:37, Markus Mohrhard wrote:
I'll do this one. You can see then how it works. You should maybe read
http://www.boost.org/doc/libs/1_52_0/libs/smart_ptr/shared_ptr.htm or
some other resource about shared_ptr.
See http://cgit.freedesktop.org/libreoffice/core/commit/?id=ec8ff9ff68622a510319c404f4745a336e65d314
for an example. Please note that I did some additional clean-up. The
important parts are that in this case operator= and the copy c'tor are
no longer needed.
The remaining parts are mainly stylistic and moving the Impl class
from the header file into the source file.
If you try to change additional places please inspect them very
carefully. As I and Eike already mentioned, shared_ptr comes with a
performance penalty that may or may not be a problem.
To be clear, I thought that ref count had been put in place long time
ago when there wasn't efficient libraries/version of libraries. So when
you first answered by quoting boost::shared_ptr, I thought it could be a
100% better solution than ref count.
Now with this performance penalty, I don't know what to think:
- don't touch anything and so keep ref counting
- find a specific solution for each case using than ref counting
- use boost::shared_ptr (but for which case which wouldn't generate perf
penalty?)
I must recognize, I had naively thought that ref count was a part where
we could make some bug proof/optimization/cleaning LO
Julien
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.