Date: Thu, 30 Oct 2025 16:35:21 -0700
On Thursday, 30 October 2025 11:13:22 Pacific Daylight Time organicoman wrote:
> What about just add a typedef member to the class implementation.
> So if the creator of the class thinks that it is not relocatable for any
> reason he just add. typedef not_reloc;
> Then in your container implementation you can just overload based ob that
> typedef or just SFINAE it away, or require it by a constraint?
We've already had a solution for that for 20 years. Detecting the presence of
a member was next to impossible back then, before C++11, so instead it is a
traits type which you can specialise for your type. There's a macro to help
you: Q_DECLARE_TYPEINFO.
https://doc.qt.io/qt-6/qtypeinfo.html#Q_DECLARE_TYPEINFO
> What about just add a typedef member to the class implementation.
> So if the creator of the class thinks that it is not relocatable for any
> reason he just add. typedef not_reloc;
> Then in your container implementation you can just overload based ob that
> typedef or just SFINAE it away, or require it by a constraint?
We've already had a solution for that for 20 years. Detecting the presence of
a member was next to impossible back then, before C++11, so instead it is a
traits type which you can specialise for your type. There's a macro to help
you: Q_DECLARE_TYPEINFO.
https://doc.qt.io/qt-6/qtypeinfo.html#Q_DECLARE_TYPEINFO
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2025-10-30 23:35:33
