scoped_ptr has no release function

Dear all, Probably there will be a good rationale for this, but the scoped_ptr has no release fct. No we have to use the auto_ptr, with all its drawbacks. Does anyone know the reason for this? Wkr, me

gast128 wrote:
Dear all,
Hi, [reordering]
Probably there will be a good rationale for this, but the scoped_ptr has no release fct. ... Does anyone know the reason for this?
From the FAQ:
"When reading source code, it is valuable to be able to draw conclusions about program behavior based on the types being used. If scoped_ptr had a release() member, it would become possible to transfer ownership of the held pointer, weakening its role as a way of limiting resource lifetime to a given context. Use std::auto_ptr where transfer of ownership is required. (supplied by Dave Abrahams)"
No we have to use the auto_ptr, with all its drawbacks.
Try move_ptr instead: http://home.comcast.net/~jturkanis/move_ptr/ The docs contain a detailed comparison w/ auto_ptr. Jonathan

O thanks. I completely missed that section. Now I have to tell the programmers here, that there is still use for auto_ptr. I had them make believe that boost's smart_ptr's are superior in every way, but I obviously forgot this case. Wkr, me

On Dec 16, 2004, at 3:49 AM, gast128 wrote:
O thanks. I completely missed that section.
Now I have to tell the programmers here, that there is still use for auto_ptr. I had them make believe that boost's smart_ptr's are superior in every way, but I obviously forgot this case.
Fwiw, Jonathan's move_ptr is superior to auto_ptr, and can completely replace it. -Howard

gast128 wrote:
O thanks. I completely missed that section.
Now I have to tell the programmers here, that there is still use for auto_ptr. I had them make believe that boost's smart_ptr's are superior in every way, but I obviously forgot this case.
The goal wasn't to replace auto_ptr, but to complement it. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

gast128 wrote:
Dear all,
Probably there will be a good rationale for this, but the scoped_ptr has no release fct. No we have to use the auto_ptr, with all its drawbacks. Does anyone know the reason for this?
See FAQ at bottom of.. http://www.boost.org/libs/smart_ptr/scoped_ptr.htm -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
participants (5)
-
David Abrahams
-
gast128
-
Howard Hinnant
-
Jonathan Turkanis
-
Rene Rivera