Re: [boost] Proposal to add smart_ptr to the boost library

"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:<drk4c6$vu8$1@sea.gmane.org>...
On 01/29/2006 06:15 PM, David Maisonave wrote:
"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:<drafuf$v06$1@sea.gmane.org>... [snip] Do you mean the test driver code in libs/policy_ptr/test is very confusing? In particular, do you find the std_ptr_shared_ptr_test.cpp confusing?
I could only answer that question if I could find that file. Where are you getting this file from? I don't see a reference to it using the following link: http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/poli cy_ptr/policy/ Could you please provide a full link to this test?
No. In general, reference-link is able to out perform reference-count logic. Smart_ptr has a policy for both methods, where-as shared_ptr only does reference-count.
OTOH, policy_ptr, also based on Alexandrescu's smart pointer library, and has, AFAICT, a reflinked policy in:
boost-sandbox/boost/policy_ptr/policy/ref_linked.hpp
What might be interesting is to compare the two methods of specifying policies. I know David Held at first did it one way, and then switched to the current way for some reason. Maybe you could compare the pros and cons to your method vs. Held's method.
The only advantage I found with reference-count is that it requires less memory. Other than that, in my test it performs the worse when compared to reference-link and reference-intrusive. I don't understand why reference-count was picked instead of reference-link for the boost::shared_ptr

David Maisonave wrote:
The only advantage I found with reference-count is that it requires less memory. Other than that, in my test it performs the worse when compared to reference-link and reference-intrusive. I don't understand why reference-count was picked instead of reference-link for the boost::shared_ptr
It's in the FAQ: http://www.boost.org/libs/smart_ptr/shared_ptr.htm#FAQ Q. Why doesn't shared_ptr use a linked list implementation? A. A linked list implementation does not offer enough advantages to offset the added cost of an extra pointer. See timings page. In addition, it is expensive to make a linked list implementation thread safe. -- Daniel Wallin

On 01/29/2006 11:27 PM, David Maisonave wrote:
"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:<drk4c6$vu8$1@sea.gmane.org>...
On 01/29/2006 06:15 PM, David Maisonave wrote:
"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:<drafuf$v06$1@sea.gmane.org>... [snip] Do you mean the test driver code in libs/policy_ptr/test is very confusing? In particular, do you find the std_ptr_shared_ptr_test.cpp confusing?
I could only answer that question if I could find that file. Where are you getting this file from? I don't see a reference to it using the following link: http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/poli cy_ptr/policy/
Could you please provide a full link to this test?
Sorry. It's in: http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/libs/polic...
participants (3)
-
Daniel Wallin
-
David Maisonave
-
Larry Evans