Boost logo

Boost :

Subject: Re: [boost] Is there any interest in non-owning pointer-like types?
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-02-01 11:22:31


On 1/31/2017 11:47 PM, Joseph Thomson wrote:
> For some time, I have been developing a pair of non-owning pointer-like
> types that I am currently calling `observer_ptr` and `observer`. I had
> planned to propose their addition to the C++ standard library, but I have
> been informed by the author of the original `observer_ptr` proposal
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4282.pdf> that
> the ISO C++ committee has rejected his proposal and made clear that it
> feels there is no place in the standard library for such types, believing
> that this role is filled to a satisfactory degree by regular pointers. I
> wholeheartedly disagree with this assessment, so I am bringing my proposal
> here instead.
>
> The `observer_ptr<T>` class template is a pointer-like type that does not
> do any resource management, and is intended to be used in place of `T*`
> wherever `T*` is used as a non-owning reference to an object of type `T`.

When referring to 'T*' I think you should always use the terminology
'pointer' rather than 'reference'. By mixing the two you are confusing
terminology, which I believe should always be distinct because a pointer
and a reference are syntactically two different things in C++.

snipped...


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