[cfe-dev] The state of clang type traits

Howard Hinnant hhinnant at apple.com
Wed May 11 18:04:51 PDT 2011


On May 11, 2011, at 8:26 PM, Howard Hinnant wrote:

> I'm confused with your point 4.  I don't know what is already implemented in mainline.  But some example code would go a long way towards my education.
> 
> For the purpose of the std::traits, "trivial" will only be applied to special members, "pseudo" special members of scalars, everything possibly cv-qualified ([basic.types]/9), arrays of those types, and void.  I can do special casing for void, arrays and cv-qualifers and scalars in the library.  There are two hard parts I really need help with:
> 
> 1.  Detecting if a specific special member (default ctor, copy ctor, move ctor, copy assignment, move assignment, dtor) of a class is trivial.
> 
> 2.  Detecting if a class has /any/ non-trivial special member ([class]/6).  E.g. if a class has a trivial A(const A&) and a non-trivial A(volatile A&), then it has a trivial copy constructor, but the class is not trivial.  (I didn't make these rules up. ;-))

Experimenting.  I'm not sure yet, but I think clang may offer all the tools for a conformant <type_traits> except for __underlying_type(T) ...

Howard




More information about the cfe-dev mailing list