C++ template type traits for class members
If xxx is a non-accessible data member (e.g. private) your code fails to compile with gcc. However this seems to be gcc bug. (stackoverflow question) Still if your code is supposed to be compilable with gcc you should consider this.
The templates give false for non-accessible (e.g. private) members. That is usually good though, because someone using quering about a class should only see the public interfacce anyway. Still consider what the intended behavior of your templates should be.
If xxx is of reference type, then your has_member_xxx will give false, because taking an address to member of reference type is not allowed.
has_member_xxx is also false if xxx is a static data member with deleted or non-accessible operator&amp;(), although this is a pathological case because I don't see a good reason to use operator&amp;() in that way. You might want to take std::addressof instead to avoid such a case.
has_member_xxx will also not detect member function templates, because the address of a function template cannot be taken. However that is probably expected behavior.
The same issue also arises for overloaded member functions, though. The adress of overloaded function can also not be taken. This is probably not intended behavior.


If you could specify exactly what your templates are supposed to detect / not detect that would be helpful.