Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-15 13:14:47


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net