Boost logo

Boost Users :

From: Daniel Krügler (dsp_at_[hidden])
Date: 2008-03-27 03:29:14


Jason Cipriani wrote:
> The boost shared_ptr lets me specify my own destructor function, but
> shared_ptr does more than I want -- I do not need thread-safety or
> reference counting, and would like to avoid the associated overhead.
>
> What I really want is an std::auto_ptr that lets me specify a
> destructor function. Does boost have something light-weight like this?

You're asking for the upcoming std::unique_ptr, but AFAIK boost
currently does not provide it (I like to be corrected here). There
exists a public domain implementation provided by Howard Hinnant, which
comes quite next to its final interface (which has yet not been decided,
but personally I'm quite sure that further changes are only marginal),

http://home.twcny.rr.com/hinnant/cpp_extensions/unique_ptr.html

(This link has been provided via issue

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#673
)

If you replace some used tr1 utilities (static_assert,
tr1::is_reference, ...) by currently existing boost analoga, it should
work for you, I guess, hmmmh, aeeh, if you have a compiler that
understands the new rvalue references....

Greetings from Bremen,

Daniel Krügler


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