Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-07-20 00:01:30


> I read all of the previous discussion of this on the boost list and did
not
> find any good arguments against mine.

> 1) Pointer specific features have been removed for smart_handle. Both
> implicit and explicit type coercion features are gone as are operators *
and ->.
I do not see anything wrong with operator* and operator->. How are you going
to provide an access to the handle value? operator* as good as anything else
for this purpose. How are you going to provide an access to methods that
handle type may expose. operator-> as good (if not best) way to do so.

> 2) Rather than taking the handle type as a template parameter,
smart_handle
> classes take a handle policy (or traits class or description class or
whatever
> the correct term is).

PBSP could do the same.

> (2) is designed to deal with the fact that the actual type of a handle
rarely
> uniquely identifies the handle type

PBSP could do the same.

> - Not all handles are pointers (e.g., file descriptors) and thus cannot be
used
> with smart_ptrs

PBSP would cover everything.

> - Semantically, handles simply aren't pointers. E.g, the pointer
deference
> operators make no sense for handles.

Again it's your point of view. I have different. and PBSP could prohibit
usage of operator* if you like so.

> - Otherwise incompatible handles may in fact be typedef'd to the same
thing -
> smart_handle makes these different types, smart_ptr does not.

PBSP could do the same.

> - smart_ptr provides pointer conversion semantics that are inappropriate
for
> handles

PBSP could prohibit any conversions.

> - smart_ptr assumes that an invalid value is designated by 0 - this is not
> necessarily true for handles

This is not true for PBSP.

I listed all you reasons. None seems to be sound enough to justify yet
another component that mimics "smart pointer" concept. Whatever you do you
will end up with either limited functionality or slightly cut version of
PBSP (IMHO). That is why I stick with the my PBSP and use it for all my
"smart pointer" needs.

Gennadiy.


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