This is what intrusive_ptr is for. Just define intrusive_ptr_add_ref and
intrusive_ptr_release for your count class.

Unless I have missed something, intrusive_ptr has the following issues:


1. You must declare intrusive_ptr_add_ref and intrusive_ptr_release as top-level functions that take a pointer to your class. This can be problematic if your client class is a nested private class as in my prior example.

2. You must define the functionality of those two functions. While the functionality is trivial, it still needs to be done manually for each class. Anything manual is subject to error.

The shared_ptr_embedded and shared_ptr_count pair solve both issues.

Scott Maxwell
PocketPurchase, Inc.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to