Missing explicit cast constructor for observer from observable
Closed this issue · 1 comments
HK47196 commented
Currently if I want to create a downcasted observer from an observable, I have to create an intermediate observer pointer of the same type as the observable then create my downcast observer from that base observer.
That is, currently this does not work:
class A {};
class B : A {};
//assume this is holding a B*
oup::observable_unique_ptr<A> a;
oup::observer_ptr<B> b{a, dynamic_cast<B*>(a.get())};
but instead requires a temporary observer_ptr of type A as an intermediate to get the observer_ptr of type B.