vector::end (STL/CLR)
被制御シーケンスの末尾を指定します。
iterator end();
解説
メンバー関数は、被制御シーケンスの末尾の次の位置を指すランダム アクセス反復子を返します。これを使用して被制御シーケンスの現在の (current) 末尾を指定する反復子を取得しますが、このステータスは被制御シーケンスの長さが変わると変化することがあります。
使用例
// 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 とベクター>
名前空間: の cliext