During a CppCon2014 conference talk by Walter E. Brown, he states that there are 15 classifications of types in C++ that the standard describes.
"15 partitions of the universe of C++ types."
"void is one of them." -- Walter E. Brown.
What are the other 14?
While digging through the standard, I found the following:
// 20.11.4.1
primary type categories:
template <class T> struct is_void;
template <class T> struct is_integral;
template <class T> struct is_floating_point;
template <class T> struct is_array;
template <class T> struct is_pointer;
template <class T> struct is_lvalue_reference;
template <class T> struct is_rvalue_reference;
template <class T> struct is_member_object_pointer;
template <class T> struct is_member_function_pointer;
template <class T> struct is_enum;
template <class T> struct is_union;
template <class T> struct is_class;
template <class T> struct is_function;
// 20.11.4.2
composite type categories:
template <class T> struct is_reference;
template <class T> struct is_arithmetic;
template <class T> struct is_fundamental;
template <class T> struct is_object;
template <class T> struct is_scalar;
template <class T> struct is_compound;
template <class T> struct is_member_pointer;
Hmm, that's more than 15. These are type traits anyhow. They are used to test certain properties of types at compile time. For example, an integer
type would give back true for is_integral
, is_fundamental
, and is is_scalar
. Perhaps the 15 are some of the ones listed above and the rest are sub categories to others.
Here's my attempt of trying to make a type tree of the language:
My guess:
1. void
2. bool
3. char
4. nullptr
5. integral (signed)
6. integral (unsigned)
7. floating
8. enum
9. array
10. class
11. union
12. lvalue reference
13. rvalue reference
14. member object pointer
15. member function pointer
But also note that bool
, char
, and enum
are all integral types, so I'm really not very confident in this list.