It seems I am having problems expressing my thoughts, people don’t understand 
what I am trying to say=(

What I've meant is to have one allocation instead of two, yes, exactly.

Back to the topic - in case we really want to support the "stack case", I’d say 
shared_ptr is the only option (in combination with enable_shared_from_this 
which is already a kinda part of QObject, as mentioned above)

> 3 мая 2019 г., в 23:54, Giuseppe D'Angelo via Development 
> <development@qt-project.org> написал(а):
> 
> Il 03/05/19 23:03, Иван Комиссаров ha scritto:
>> I’d say it’s an implementation detail - it *is* possible to implement the 
>> creation of QObjects more efficient than it is done now without «forcing» 
>> user to use objects on stack to avoid allocations.
> 
> Unless you also sacrifice binary compatibility, it's not possible.
> 
> What it is possible is to have one allocation instead of 2 (the object and 
> its dpointer), that's already been worked upon with a custom operator new, 
> check the patches on gerrit.
> 
> Anyhow this is entirely orthogonal to the original problem at hand: 
> ownership. We need to support the case of objects created on the stack (not 
> owned and owned).
> 
> Cheers,
> -- 
> Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
> 
> _______________________________________________
> Development mailing list
> Development@qt-project.org
> https://lists.qt-project.org/listinfo/development

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to