Or maybe you can’t I didn’t think about the fact that public ctor allocates d_ptr itself… Need to think a bit more=(
> 3 мая 2019 г., в 23:03, Иван Комиссаров <abba...@gmail.com> написал(а): > > You can use the same technique in qMakeChild as in std::make_shared - to > allocate MyObjectPrivate and space for the d_ptr in one go. Probably will > require some additional macroses, though, to hide the implementation > (sizeof(MyObjectPrivate)) in the cpp file. > > 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. > _______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development