[Development] Should qMetaTypeId<const T>() == qMetaTypeId<T>() ?
Jędrzej Nowacki
jedrzej.nowacki at qt.io
Wed Aug 24 16:06:50 CEST 2016
On onsdag 24. august 2016 15.23.01 CEST Marc Mutz wrote:
> Hi,
>
> Currently, it's not, which doesn't make much sense, does it?
>
> So,
>
> template <typename T>
> int qMetyTypeId<T>() {
> return qMetaTypeIdHelper<typename std::remove_cv<T>::type>();
> }
>
> ?
>
> (There's of course a lot more involved in this, registration should discard
> const, too, e.g.).
>
> Thanks,
> Marc
Hi,
From C++ perspective const T and T are kind of separate types, metatype mimics
that. QMetaType is used in many places and in some constness matters.
Consider that example:
QMetaType::typeName(qMetaTypeId<const QString>())
and
QMetaType::typeName(qMetaTypeId<QString>())
The function is used in metaobject to compute signatures of invokables.
Cheers,
Jędrek
More information about the Development
mailing list