Boost logo

Boost :

Subject: Re: [boost] Is there any interest in non-owning pointer-like types?
From: Jonathan Müller (jonathanmueller.dev_at_[hidden])
Date: 2017-02-04 09:06:00


I'll just throw my 2cts in for consideration:

I have implemented something called `object_ref` as part of my type safe
library (github.com/foonathan/type_safe). It seems similar to the discussed
`observer`. `object_ref` is basically a guaranteed non-null pointer. I
think something like that is definitely useful, as references have weird
semantics.

On the other hand I don't think having `observer_ptr` as simply a pointer
like type is that useful. An optional observer is better, as a properly
designed optional can provide stuff like value_or()/map() etc which makes
handling the null case easily. That's why I've implemented `optional_ref`
as part of type safe.

Jonathan


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