[Development] parented_ptr
Ville Voutilainen
ville.voutilainen at gmail.com
Tue Nov 4 21:04:56 CET 2025
On Tue, 4 Nov 2025 at 13:07, Daniel Schürmann <daschuer at mixxx.org> wrote:
> if you want an universal:
>
> parent->createChild<QLabel>();
>
> It is possible with C++23 and if we assume that either the fist or the last parameter is the parent.
> Quite cumbersome. I would like to postpone this for now.
>
> Does that make sense?
Sure, it makes sense to postpone the idea of such a universal thing.
But while doing that, I think it continues to make perfect sense to
have a less-universal version of it.
new Child(parent);
looks very weird, and
parent->createChildObject<Child>();
would be quite an improvement.
And QParentedPointer can still be universal, because it would just
assert the same p->parent() for multiple
different types, even if those parents are of different types.
More information about the Development
mailing list