vector::end (STL/CLR)
指定受控制序列的結尾。
iterator end();
備註
成員函式會傳回隨機存取 iterator 受控制序列結尾之外,只要該點為單位。 您會用它來取得指定受控制序列之 current 結尾的 Iterator,但是如果受控制序列的長度變更,它的狀態也會變更。
範例
// cliext_vector_end.cpp
// compile with: /clr
#include <cliext/vector>
int main()
{
cliext::vector<wchar_t> c1;
c1.push_back(L'a');
c1.push_back(L'b');
c1.push_back(L'c');
// display initial contents " a b c"
for each (wchar_t elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// inspect last two items
cliext::vector<wchar_t>::iterator it = c1.end();
--it;
System::Console::WriteLine("*-- --end() = {0}", *--it);
System::Console::WriteLine("*--end() = {0}", *++it);
// alter first two items and reinspect
*--it = L'x';
*++it = L'y';
for each (wchar_t elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
需求
標頭: < cliext/向量 >
Namespace: cliext