|
Boost : |
From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-02-20 14:16:15
> -----Original Message-----
> From: Phil Nash [mailto:phil.nash.lists_at_[hidden]]
> Sent: Thursday, February 20, 2003 1:13 PM
> To: Boost mailing list
> Subject: Re: [boost] Re: smart_ptr vs smart_resource
>
>
> [Anthony Williams]
> > On Windows, for example, you can use GlobalAlloc to
> allocate some memory,
> and
> > you get an HGLOBAL back --- a handle to the memory. You need to call
> > GlobalLock with that handle to get a pointer to the memory
> which you can
> > actually use. The resource manager therefore needs to keep
> track of the
> > handle, rather than the pointer (which may be different
> after different
> calls
> > to GlobalLock, if there has been an intervening
> GlobalUnlock). Indeed, the
> > pointer to the locked memory is essentially a separate
> resource, acquired
> with
> > GlobalLock() and released with GlobalUnlock. It would be
> sensible to be
> able
> > to use the same framework for both the handle and the pointer.
>
> This sounds like a perfect case where using a smart_PTR would be very
> confusing, maybe dangerously so!
The only place where you will see usage of the name smart_ptr is somewhere
deep in library code:
typedef smart_ptr <...> GlobalMemoryHandler;
After that you will use non-confusing name GlobalMemoryHandler.
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk