First of all, many people say that size_type is irrelevant to machines. This is a pity .... Then, many people simply don't think about what the two are ....
1. size_type: the type defined by the string type and the vector type to save the length of any string object or vector object. The standard library type defines size_type as the unsigned type.
2, string: the type of size_type is generally unsigned int, but the length may be different for Win32 and win64 in different machine environments; size_type is generally also unsigned int;
3. For more information, see:
String: size_type A = 123;
Vector <int> size_type B = 234;
Size_t B = 456;
4. When size_t is used, the header file must be <cstddef> [<tchar. h> (_ T ()]; When size_type is used, <string> or <vector>
5, sizeof (string: size_type)
Sizeof (vector <bool >:: size_type)
Sizeof (vector <char >:: size_type)
Sizeof (size_t)
The length is equal, and the length is Win32: 4 win64: 8;
6. Relationship between the two: When the subscript is used to access the element, the vector uses vector: size_type as the subscript type, and the correct type of the array subscript is size_t;
There are more things that need to be accumulated.
More information:
Http://blog.csdn.net/wallwind/article/details/6583714 wallwind.