The following structs implement classification as defined by section 3.9 in the C++ standard. All types can be classified into one of ten basic categories:
Top level cv qualifications do not affect type classification. For example, both const int and int are considered to be of integral type.
bool b = is_XXX<T>::value;
where is_XXX is one of the ten basic categories.
There are also five categories that are made up of combinations of the ten basic categories:
The classifications: is_enum and is_union do not currently work automatically. Enumerations and unions will be mistakenly classified as class type. This can be corrected on a case by case basis by specializing is_enum_imp or is_union_imp. These specializations are in the Metrowerks::details namespace.
is_extension is also provided for those types that we provide as an extension to the C++ standard. is_extension<T>::value will be false for all types except for long long and unsigned long long.
has_extension is a modified form of is_extension that answers to true if a type is either an extension or contains an extension.
bool b = is_integral<volatile int>::value; The value of b is true.
enum MyEnum {zero, one, two}; template <> struct Metrowerks::details::is_enum_imp<MyEnum> {static const bool value = true;};
is_extension<long long*&>::value; // false has_extension<long long*&>::value; // true