Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-01-05 04:41:20


> news:btb6pj$jqs$1_at_sea.gmane.org...
> > [...]
> > This I don't get. With foo( T& ) I can call your function without
> > creating a smart ptr. The other way around is not as general.
> > So what would an interface that takes the smart pointer, and
> > only a particular smart ptr, document (besides that it only takes
> > a particular type of smart pointer)?
>
> Well, I would want to take a pointer because the pointer could
> be null.

yes. got it.

> 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.

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

> Don't
> you use smart pointers that way?

I've never done it like that.

br

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk