Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-06-11 13:53:55

> Hi,
> Recently I grew tired always having to write the same boiler plate
> code when I wanted to manage a resource using the "resource
> acquisition is initialization" technique.

> * the non-copyable resources (boost::scoped_ptr and
> boost::scoped_array)
> * the shared resources (boost::shared_ptr and boost::shared_array)
> * resources that aren't shared but can be copied (E.g. Win32
> values)
> Three base classes handle these three cases.
> I would very much appreciate some input on the issue (is this
> approach OK? Is the solution useful enough to be turned into a
> library?)


I'd be interested in this approach, especially if it saves me some
syntax. Can you give an example of the use of these classes (say, show
us the implementation of scoped_ptr with it)? The problem I see is that
I don't see a whole lot of typing getting saved with the standard
full-ownership RAII classes. The other cases maybe.

Also, I'm not a Win32 programmer at all. Can you maybe explain in what
sense these things can be copied but aren't shared? If two things have
a copy, they are sharing the resource, no?


George Heintzelman

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