[Development] The future of smart pointers in Qt API
Allan Sandfeld Jensen
kde at carewolf.com
Fri Jan 31 21:09:24 CET 2020
On Freitag, 31. Januar 2020 21:04:58 CET Ville Voutilainen wrote:
> On Fri, 31 Jan 2020 at 21:23, Alberto Mardegan
> <mardy at users.sourceforge.net> wrote:
> > Old man here:
> > On 31/01/20 13:07, Vitaly Fanaskov wrote:
> > > But how to use them in the API and which way is preferable is still
> > > unclear. There are two main options we have:
> > >
> > > 1) Use std::* smart pointers as-is.
> > >
> > > 2) Add Qt-style wrappers around std::* smart pointers and move old
> > > implementations of Qt smart pointers to the Qt5Compact module.
> > 2.
> > I still have trouble understanding why std::unique_ptr is called like
> > this, whereas I could immediately understand what QScopedPointer does
> > even before reading its documentation.
> What would you then name a Qt counterpart of std::unique_ptr, considering
> that QScopedPointer is not such a counterpart?
QScopedPointer is exactly the counterpart to unique_ptr, the only difference
is the decision not to provide a move constructor and assignment when we
finally were allowed to use C++11,
More information about the Development