[cfe-dev] Type traits to identify pointers to ObjC types?

Nicola Gigante nicola.gigante at gmail.com
Sun Dec 18 09:17:16 PST 2011


Hello.

Does clang support any built-in type trait to identify if a given T* is
a pointer to an ObjC class?

This could be useful to specialize some templates in library code
that is meant to be useful in ObjectiveC++ mode.

For example, some non-STL generic containers like Qt ones (especially QList),
use a trick to reduce code size: they use a non-template internal implementation
that handles void* elements, and then cast to the specific types in a lightweight
templated wrapper. For this reason, i believe ARC breaks with Qt containers,
while it works like a charm with the STL.
Should they want to make Qt containers work with ARC, they'd need to know
when they're dealing with ObjC objects pointers and someway specialize the 
implementation.

Does such a trait exist? If not (as I suppose), what do you think about adding it?

Thanks,
Nicola



More information about the cfe-dev mailing list