Boost logo

Boost :

From: Vincent Bhérer-Roy (vbr.boost_at_[hidden])
Date: 2007-06-20 01:31:51


Christopher Diggins called this kind of pointers "unsmart pointers"
in a CUJ article:

http://www.ddj.com/dept/cpp/184401977
http://www.ddj.com/dept/cpp/184402003

Although it doesn't present exactly the same functionnality, it
applies well to it. He is maybe not the first to put that name on
that concept however.

I often use the kind of pointer Alex just presented to us. However I
call it ref_ptr, as I use it to make an optional reference to
something. The main advantages of this dumb/unsmart pointer for me is:

1- As Alex says, to standardize the pointer interface. Some may like,
some other not, but I personally like it.
2- Explicitly specify that this is a pointer without any ownership
relation. With legacy code where you can have a mix of smart pointers
and explicit memory managment, it can be useful.
3- Default init to null, so no more uninitialized pointers.
4- assert that the pointer is not null at * or ->

Vincent Bhérer-Roy

On 19-Jun-07, at 19:04, Michael Marcin wrote:

>
> Perhaps a more fitting name would be dumb_ptr then.
>
> :)
>
> - Michael Marcin
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/
> listinfo.cgi/boost


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