vector<int>::size_type in C++

Simplicity picture Simplicity · Jan 31, 2011 · Viewed 71.3k times · Source

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.

Answer

fredoverflow picture fredoverflow · Jan 31, 2011

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.