[Development] unique_ptr and Qt, Take 2
Иван Комиссаров
abbapoh at gmail.com
Fri May 3 21:25:55 CEST 2019
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.ks at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190503/1ab26ac5/attachment.html>
More information about the Development
mailing list