[Interest] QScopedPointer and c++11 move semantics

Konstantin Tokarev annulen at yandex.ru
Fri Dec 30 20:32:16 CET 2016



30.12.2016, 22:31, "Alexander Dyagilev" <alervdvcw at gmail.com>:
> Another,  i think a better idea:
>
> Just rename QScopedPointer to QUniquePointer.

Just use std::unique_ptr<>

>
> THEN:
>
> 1. class QScopedPointer : public QUniquePointer {}
>
> 2. in this new QScopedPointer class forbid all the move semantics.
>
> Isn't it a brilliant idea? :)
>
> On 12/30/2016 10:27 PM, Alexander Dyagilev wrote:
>> Hmmm.... So there is not std::unique_ptr analogue in Qt?
>>
>> And we have to use std::unique_ptr with a special deleter...
>>
>> (I would like to use &QObjet::deleteLater one).
>>
>> Sadly...
>>
>> Why don't you just introduce another class with another name that do support?
>>
>> E.g. QUniquePointer : public QScopedPointer {...}. Or write a completely new one if you don't like this style...
>>
>> On 12/30/2016 10:18 PM, Giuseppe D'Angelo wrote:
>>> Il 30/12/2016 19:47, Alexander Dyagilev ha scritto:
>>>> Hello, https://bugreports.qt.io/browse/QTBUG-29754 states that the problem was fixed and QScopedPointer supports it now.
>>>
>>> I implemented it in 5b9006bbdba7dcab01b8e640554a7d7a4b64f76b, but then a discussion on the mailing list caused the change to be reverted in 3f6ed5566fcfbbba4cadfade460460f8ebf06ad3. The rationale was that the name "QScopedPointer" implies that the pointer cannot escape the scope, and move operations whould allow that. HTH,
>>>
>>> _______________________________________________ Interest mailing list Interest at qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
> ,
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Regards,
Konstantin



More information about the Interest mailing list