int main( )
{
using namespace std;
list <int> c1;
list <int>::size_type i;
c1.push_back( 1 );
i = c1.size( );
cout << "List length is " << i << "." << endl;
c1.push_back( 2 );
i = c1.size( );
cout << "List length is now " << i << "." << endl;
}
I think I understood what it means
it means that since list is a template class the type of list size can differ with
different type parameters and type of the size in the class will be int in this case , is that correct ?
Now the actual type of "size_type" can be modified by changing just one line (line 5). Suppose five years from now the STL is working on my 128-bit computer. The number of items a list can hold are more than unsigned long, so the list will define "size_type" to match: typedefunsigned tredint size_type;
(where "tredint" is our hypothetical 128-bit integer type")
And you can always reference that type through an actual type instance: typedef list <int> ::size_type a_big_unsigned_number;