Ru-Brd |
With all the classification templates described in the previous section, only class types ( class es, struct s, and union s) remain to be recognized. One approach is to use the SFINAE principle as demonstrated in Section 15.2.2 on page 266. Another approach is to proceed by elimination : If a type is not a fundamental type, not an enumeration type, and not a compound type, it must be a class type. The following straightforward template implements this idea: // types/type8.hpp template<typename T> class IsClassT { public: enum { Yes = IsFundaT<T>::No && IsEnumT<T>::No && !CompoundT<T>::IsPtrT && !CompoundT<T>::IsRefT && !CompoundT<T>::IsArrayT && !CompoundT<T>::IsPtrMemT && !CompoundT<T>::IsFuncT }; enum { No = !Yes }; }; |
Ru-Brd |