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

Giuseppe D'Angelo dangelog at gmail.com
Thu Jul 4 22:02:21 CEST 2013


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-type
--
Giuseppe D'Angelo



More information about the Interest mailing list