C++ vector::size_type Explained

c++size-typevector

What is meant by this C++ statement?

vector<int>::size_type x;

And, what is the use of the scope operator :: here? In other words, how do we read this statement in English?

For example, for X::x(){...}, we say that x() is a member function of class X.

Best Answer

size_type is a (static) member type of the type vector<int>. Usually, it is a typedef for std::size_t, which itself is usually a typedef for unsigned int or unsigned long long.

Related Question