
The recent lively thread in comp.lang.c++.moderated has sparked my interest in the policy_ptr proposal. Is the final version of the submission available? -- Peter Dimov http://www.pdimov.com

Peter Dimov wrote:
The recent lively thread in comp.lang.c++.moderated has sparked my interest in the policy_ptr proposal. Is the final version of the submission available?
Sadly, no. I'm still working on it. But if you want to poke around the sandbox and make comments now, that would be delightful. Dave

David B. Held wrote:
Peter Dimov wrote:
The recent lively thread in comp.lang.c++.moderated has sparked my interest in the policy_ptr proposal. Is the final version of the submission available?
Sadly, no. I'm still working on it. But if you want to poke around the sandbox and make comments now, that would be delightful.
Well... I'm asking because I have looked at the sandbox and none of the code or docs there seemed up to date.

On 03/26/2005 05:03 PM, Peter Dimov wrote:
David B. Held wrote:
Peter Dimov wrote:
The recent lively thread in comp.lang.c++.moderated has sparked my interest in the policy_ptr proposal. Is the final version of the submission available?
Sadly, no. I'm still working on it. But if you want to poke around the sandbox and make comments now, that would be delightful.
Well... I'm asking because I have looked at the sandbox and none of the code or docs there seemed up to date.
As Peter noted, the docs are not up to date. In particular the docs make no mention of the nested to template which occurs in: http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/libs/policy_ptr/test/smart_ptr_test.cpp?rev=1.6&view=auto So, I started reading the code and found it would have been helpful to have read something in the docs, say in a "programmer's guide" or "rationale" section, which mentioned that the policies were "chained" together. IOW, the conversion policy is "chained" to the checking policy, and I guess the checking policy is "chained" or, more concretely, derived from the ownership policy. Just my $0.02 worth. -Regards, Larry

David B. Held wrote:
Peter Dimov wrote:
The recent lively thread in comp.lang.c++.moderated has sparked my interest in the policy_ptr proposal. Is the final version of the submission available? [snip] Well... I'm asking because I have looked at the sandbox and none of the code or docs there seemed up to date. The docs are still not up to date, but the code now works with most tests in libs/policy_ptr/test. The one test which fails is std_ptr_binary_node_test. It fails during
On 03/26/2005 05:03 PM, Peter Dimov wrote: the test of the emulation of shared_ptr for collecting cycles. The code in: libs/policy_ptr/src/detail/collector_sp_counted_tagged.cpp is *supposed* to be an accurate conversion of: libs/smart_ptr/src/sp_collector.cpp to use policy_ptr emulations. The conversion does appear to get the same output as: libs/policy_ptr/test/collector_test.cpp which is provided by: libs/policy_ptr/test/collector_sp_counted_tagged_test.cpp Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested. -Regards, Larry

On 06/14/2005 05:54 PM, Larry Evans wrote: [snip]
most tests in libs/policy_ptr/test. The one test which fails is std_ptr_binary_node_test. It fails during the test of the emulation of shared_ptr for collecting cycles. The code in:
libs/policy_ptr/src/detail/collector_sp_counted_tagged.cpp
is *supposed* to be an accurate conversion of:
libs/smart_ptr/src/sp_collector.cpp
[snip]
Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested.
There's also changes in: boost/policy_ptr/detail/shared_count_sp_counted_tagged.hpp which may be relevant. The changes in this file as well as others are indicated by: // SHARED_PTR_DIFF_NOTE:

Larry Evans wrote:
Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested.
I'm not sure whether we should invest any effort in porting sp_collector.cpp; it's not an official part of shared_ptr and doesn't work reliably. Have you looked at reset_and_collect.cpp, which relies on user enumeration but is 100% portable and doesn't need access to the shared_ptr implementation? http://lists.boost.org/boost-users/2005/05/11805.php It can be made incremental without much extra effort.

On 06/15/2005 12:47 PM, Peter Dimov wrote:
Larry Evans wrote:
Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested.
I'm not sure whether we should invest any effort in porting sp_collector.cpp; it's not an official part of shared_ptr and doesn't work reliably.
Do you mean it doesn't work reliably because 1) the test for shared_ptr existence within a gc object is "conservative" and could result in "false" pointers and thereby retain memory which should be freed or: 2) the code has got a bug in it (I've no idea) or: 3) the code is not thread safe (I've no idea) or: something else?
Have you looked at reset_and_collect.cpp, which relies on user enumeration but is 100% portable and doesn't ^^^^^^^^^^^^^^^^ Do you mean each gc'ed object must have a virtual enumerate function which enumerates the shared_ptr's contained within that object?
need access to the shared_ptr implementation?
Thanks, I first looked at it today. I *may* begin trying to convert it for use with policy_ptr, but I don't know how the reliance on a user provided virtual enumerate function will be received; hence, I'm sort of reluctant to convert it. Thanks for the link and the response. -regards, Larry

Larry Evans wrote:
On 06/15/2005 12:47 PM, Peter Dimov wrote:
Larry Evans wrote:
Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested.
I'm not sure whether we should invest any effort in porting sp_collector.cpp; it's not an official part of shared_ptr and doesn't work reliably.
Do you mean it doesn't work reliably because
1) the test for shared_ptr existence within a gc object is "conservative" and could result in "false" pointers and thereby retain memory which should be freed
This, and the fact that it can't follow a vector< shared_ptr<> > member, for instance.

On 06/14/2005 05:54 PM, Larry Evans wrote:
On 03/26/2005 05:03 PM, Peter Dimov wrote: [snip] cycles. The code in:
libs/policy_ptr/src/detail/collector_sp_counted_tagged.cpp
is *supposed* to be an accurate conversion of:
libs/smart_ptr/src/sp_collector.cpp
[snip]
Maybe you could more easily find the error in the conversion of sp_collector.cpp than me, if you're interested. Never mind. My mistake. I'd hardcoded the collection method as the one for precise collection instead of sp_counted_tagged.
I'll upload corrections to sandbox tomorrow.
participants (3)
-
David B. Held
-
Larry Evans
-
Peter Dimov