Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2004-01-05 06:32:59

"Thorsten Ottosen" <nesotto_at_[hidden]> wrote in message
> [...]
> > And I would want to take a smart pointer with shared
> > semantics, because that says foo() isn't responsible for cleaning
> > it up if something happens (or even if nothing happens).
> ok. If this kind of documentation is important, then I guess one could
> achieve the same (though differently) by having a coding guide-line
> that says naked pointers means no ownership and auto_ptr means
> that foo takes ownership.

But you are still missing shared ownership. Sometimes, you want to
know that p is safe, but you don't have to worry about it. That's why
you specify a shared pointer.

> So how do you say foo() is responsible for clean up?

You already said it: void foo(auto_ptr<T> p). ;)

> > Don't you use smart pointers that way?
> I've never done it like that.

It's never too late to start. ;)


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003

Boost list run by bdawes at, gregod at, cpdaniel at, john at