vector::end() 函数的语法
vector::end();
参数: none——它什么都不接受。
返回值: iterator– 它返回一个指向向量的 past-the-end 元素的迭代器。
实际上Vector中的begin和end函数是左闭右开的区间。
例:
Input:
vector<int> vector1{ 1, 2, 3, 4, 5 };
Function call:
vector<int>::iterator it;
it = vector1.begin();
cout << *it << endl;
it = vector1.end()-1;
cout << *it << endl;
Output:
1
5
本文介绍了C++中vector::end()函数的语法、参数和返回值。该函数不接受参数,返回指向向量past - the - end元素的迭代器,且Vector的begin和end函数构成左闭右开区间,还给出了使用示例。
1万+

被折叠的 条评论
为什么被折叠?



