That’s exactly why observer_ptr should not* be implemented as alias to a raw 
pointer; the main difference is that constructor from T* is explicit and 
there’s no implicit cast from observer_ptr to unique_ptr, so your example will 
not compile =)

* well, the clang implementation I used forbids implicit cast, not sure how it 
will (if it ever will) be implemented in c++20

> 3 мая 2019 г., в 21:09, Konstantin Ritt <ritt...@gmail.com> написал(а):
> 
> Ivan,
> 
> note that observer_ptr is mostly like
> 
> template<typename T>
> using observer_ptr = T*;
> 
> so what about
> 
> 
> layout2->addWidget(layout->addWidget(make_unique<QPushButton>("right")))->setFlat(true);
> ?
> 
> 
> Regards,
> Konstantin
> 

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to