0

I was wondering if anyone has come across a system like QSharedDataPointer and QSharedData for implicit sharing, which is appropriate for use with the pimpl idiom, in an alternative library to Qt?

I have been trying to avoid adding extra dependencies to my system if that's possible and am simply wondering what my options might be.

demonplus
  • 5,613
  • 12
  • 49
  • 68
Jonathan Pierce
  • 184
  • 1
  • 1
  • 11
  • They're simple enough you can reimplement those classes yourself, or extract them from Qt... (usual license warnings apply). – peppe Nov 20 '13 at 15:38

2 Answers2

1

Adobe provides a copy_on_write<T> header in their stlab library.

0

A similar system can be found here. The main difference is that a boost::shared_ptr is used for having a reference counted shared pointer instead of requiring that the object inherit from a supplied class which provides the reference counting functionality.

Although I have not yet tried it, it may have a slightly higher overhead compared to the qSharedDataPointer due to the boost::shared_ptr dereference, however the cost is a trade off against it's more convenient usage.

Jonathan Pierce
  • 184
  • 1
  • 1
  • 11