I think any specialized size_type, such as string::size_type and
vector<T>::size_type, is defined in terms of size_t, which is much
more low level. Since they are more or less equivalent, what's the
advantage of using size_type over size_t?
In theory, or in practice?
In theory, vector and basic_string have an additional template
argument, which is an allocator. It defaults to the standard
allocator (so you don't have to specify it), and the standard
allocator is required to define size_type as size_t. But other,
user defined allocators can define it as something different.
(The size_type in vector and basic_string is just a typedef to
the type in the allocator.)
In practice, allocators are very subtle, not easy to use, and in
fact rarely used. Unless you're writing truly generic code, you
can generally ignore the issue, and just use size_t.
(I think that allocators were originally invented to support the
different types of pointers on a 16 bit Intel processor, so that
if e.g. you were compiling in small, with size_t a 16 bit
unsigned int, you could still declare a vector with an allocator
which used huge model, with 32 bit pointers and a 32 bit
unsigned long for size_type. In that context, they actually
make sense.)