Member types are just typedef
s (or sometimes full classes) that are useful for using and/or somehow related to the class itself.
As you ask about member types in general, lets take std::vector
as example:
template < class T, class Alloc = allocator<T> > class vector;
It's a template with type T
(and an allocator, doesn't matter).
Now, std::vector
contains an member type std::vector::value_type
, which always is defined to be the same type as T
. Eg for vector<int>
, std::vector::value_type
is the same as int
, and you can use it to define new variables etc.
Similar, there are pointer
and reference
and some other things which resolve to int*
and int&
.
Then, there is size_type
, which defines a variable suitable to hold all possible vector length values ... Because eg. it's usually different on X86 and X64 (and, for some classes, it can depend on the implementation, and...), it's useful to have somthing like that.
And so on...