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

"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:<drafuf$v06$1@sea.gmane.org>...
On 01/24/2006 09:45 AM, David Maisonave wrote:
Since the current smart_ptr (policy_ptr) class at boost vault is on
hold, I like to propose adding the following smart_ptr class to the
boost library:
Could you eliminate the tabs and reformat to something like 75 or 80
columns to ease reading. An example is in
http://boost-consulting.com/vault/Memory. Also, boost convention is
.hpp (or hxx or something like that) extension instead of .h.
I didn't get a chance to see the above link. I'll try to cut it down to 100 columns. I find 80 to be too limiting, and most developers now days have access to editors with wider column view. On my editor, the 80 column point actually is in the center of my screen.
IMHO, the above class has more functional features, than the class
in
I notice policy_ptr has a weak_ptr class. Does axter smart_ptr has
something similar to handle cycles in pointer graph?
No. Currently it does not support weak_ptr, although it does support (pointee) comparison Semantics like weak_ptr. It does not support any other weak_ptr specific feature.
the boost vault, and the class is ready for use.
I've compiled and run the policy_ptr tests with g++.
Do you have any example code? I like to see some usage example for policy_ptr. Just looking at the policy_ptr code is very confusing, and it is hard to tell how to use it.
In my performance test, the shared and COW policies along with
reference-link policy, are able to out perform the
boost::shared_ptr.
Could this be due to shared_ptr having two refcounts and smart_ptr
having just one?
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.

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]
I notice policy_ptr has a weak_ptr class. Does axter smart_ptr has something similar to handle cycles in pointer graph?
No. Currently it does not support weak_ptr, although it does support (pointee) comparison
Semantics like weak_ptr. It does not support any other weak_ptr specific feature.
the boost vault, and the class is ready for use.
I've compiled and run the policy_ptr tests with g++.
Do you have any example code? I like to see some usage example for policy_ptr. Just looking at the policy_ptr code is very confusing, and it is hard to tell how to use it.
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?
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.
participants (2)
-
David Maisonave
-
Larry Evans