vector::rend (STL/CLR)
指定已還原的受控制序列結尾。
reverse_iterator rend();
備註
成員函式會傳回反向的 iterator 那些只是超出開頭受控制序列的點。因此,它會指定反向序列的 end。您要用它來取得的 Iterator 可指定以相反順序顯示的受控制序列之 current 結尾,但是,如果受控制序列的長度變更,它的狀態也可以變更。
範例
// cliext_vector_rend.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 first two items
cliext::vector<wchar_t>::reverse_iterator rit = c1.rend();
--rit;
System::Console::WriteLine("*-- --rend() = {0}", *--rit);
System::Console::WriteLine("*--rend() = {0}", *++rit);
// alter first two items and reinspect
*--rit = L'x';
*++rit = L'y';
for each (wchar_t elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
需求
標頭: < cliext/向量 >
Namespace: cliext