Subject: Re: [boost] Is there any interest in non-owning pointer-like types?
From: Joseph Thomson (joseph.thomson_at_[hidden])
Date: 2017-02-09 23:24:01
On 10 Feb 2017 5:16 a.m., "Edward Diener via Boost" <boost_at_[hidden]>
On 2/9/2017 1:56 PM, Gottlob Frege via Boost wrote:
> - I think pointer or reference like things should be named _ptr or
> _ref etc. (In comparison, optional and any can be null, but own their
> value, they don't reference an external value.)
I agree that adding _ptr to something that takes the form of a pointer is a
I am not opposed to this nomenclature. One of the reasons I avoided the
`_ptr` suffix was my concern that people would reflexively reject the idea
of a pointer-like type that has no null state and is constructible only
from `T&`. In my view, the feature that *makes* a pointer-like type is
reference semantic comparison (as opposed to value semantic)... and maybe
the presence of `*` and `->` operators. So I'm fine with this naming
convention if others are.
- 'observer' has already been taken by the Gang of Four as a design
> pattern. Unfortunately. We could re-take the term, but it does add
I see no confusion using a term which has been mentioned as a design
I am personally comfortable with the name, but I do see the argument about
the potential for confusion. A rose by any other name would smell as sweet.
- I've suggested cadged_ptr in the past - it is not a great word, as
> it it not very common, but it is actually the right meaning.
I do not think it is necessary to use a fairly obscure word as opposed to a
more common term, unless that common term is misleading.
I initially read that as `caged_ptr`. I looked up the definition, and it
does seem to have the right meaning. If such an uncommon word is
undesirable, perhaps `obseved_ptr` or `watched_ptr` would be preferable
(the "-ed" form of the veb matches `shared_ptr`).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk