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

Douglas Gregor dgregor at apple.com
Wed Dec 21 13:55:01 PST 2011


On Dec 21, 2011, at 1:51 PM, Nicola Gigante wrote:

> 
> Il giorno 19/dic/2011, alle ore 17:00, Douglas Gregor ha scritto:
> 
>> 
>> This kind of thing works fine in C++98/03 as well. It's probably worth checking that T is a pointer type, so you don't treat something like
>> 
>> struct X {
>> 	operator id() const;
>> };
>> 
>> as an Objective-C pointer type.
>> 
> 
> Thanks.
> What about the standard is_base_of trait? libc++ implements
> it with an intrinsic, if supported, or with template tricks if not.
> Looking at it, the "tricks" version should already work with Objective-C types
> (apart from a is_class check, maybe) while the clang intrinsic seems not.
> Could it be possible to make it work with Objective-C types?

Yes.

> Same thing with other traits, like is_class. Should they return
> sensible answers on Objective-C types?

Yes, they should return sensible answers for Objective-C types.

	- Doug



More information about the cfe-dev mailing list