[Interest] Qt 5.1, does QVector not support std::unique_ptr?

Thiago Macieira thiago.macieira at intel.com
Thu Jul 4 23:12:17 CEST 2013


On quinta-feira, 4 de julho de 2013 22.11.40, Mark wrote:
> On Thu, Jul 4, 2013 at 10:02 PM, Giuseppe D'Angelo <dangelog at gmail.com> 
wrote:
> > On 4 July 2013 21:50, Mark <markg85 at gmail.com> wrote:
> >> Defining a QVector with an std::unique_ptr seems to work just fine. No
> >> error, compile wise.
> >> QVector<std::unique_ptr<QUrl>> test;
> > 
> > You can't use std::unique_ptr in Qt containers. Qt containers require
> > the type to have a default constructor, a copy constructor, and an
> > assignment operator [1], and you can't copy a std::unique_ptr.
> > 
> > [1]
> > http://qt-project.org/doc/qt-5.0/qtcore/containers.html#assignable-data-t
> > ype --
> > Giuseppe D'Angelo
> 
> Ahh, oke. That makes it obvious.
> 
> But is this something that is planned to be allowed for a future Qt
> version? Please don't say "Qt 6" :p

It's not planned, period. The Qt containers will forever require the ability 
to copy.

It doesn't make sense to introduce containers that don't. Those are called 
"Standard Library".

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130704/ec7d74de/attachment.sig>


More information about the Interest mailing list