4 Feb
2017
4 Feb
'17
9:06 a.m.
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