C++中的vector<int>::size_type

2021-12-21 00:00:00 vector c++ size-type

这个 C++ 语句是什么意思?

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?

例如对于X::x(){...},我们说x()是一个成员函数class X.

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

推荐答案

size_typevector<类型的(静态)成员类型/代码>.通常,它是 std::size_ttypedef,它本身通常是 unsigned inttypedefunsigned long long.

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.

相关文章