list::end (STL/CLR)
指定受控制序列的結尾。
iterator end();
備註
成員函式會傳回隨機存取 iterator 受控制序列結尾之外,只要該點為單位。 您用它來取得 iterator,指派受控制序列中 ; 結尾 其狀態沒有變更如果變更受控制序列的長度。
範例
// cliext_list_end.cpp
// compile with: /clr
#include <cliext/list>
int main()
{
cliext::list<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::list<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