map::rbegin (STL/CLR)

指定已還原的受控制序列開頭。

    reverse_iterator rbegin();

備註

成員函式會傳回反向的 iterator,指派受控制序列中,或只是超出空序列開頭的最後一個元素。因此,它會指定反向序列的 beginning。您會用它來取得指定以反向順序顯示之受控制序列 current 開頭的 Iterator,但是如果受控制序列的長度變更,它的狀態也會變更。

範例

// cliext_map_rbegin.cpp 
// compile with: /clr 
#include <cliext/map> 
 
typedef cliext::map<wchar_t, int> Mymap; 
int main() 
    { 
    Mymap c1; 
    c1.insert(Mymap::make_value(L'a', 1)); 
    c1.insert(Mymap::make_value(L'b', 2)); 
    c1.insert(Mymap::make_value(L'c', 3)); 
 
// display contents " [a 1] [b 2] [c 3]" 
    for each (Mymap::value_type elem in c1) 
        System::Console::Write(" [{0} {1}]", elem->first, elem->second); 
    System::Console::WriteLine(); 
 
// inspect first two items in reversed sequence 
    Mymap::reverse_iterator rit = c1.rbegin(); 
    System::Console::WriteLine("*rbegin() = [{0} {1}]", 
        rit->first, rit->second); 
    ++rit; 
    System::Console::WriteLine("*++rbegin() = [{0} {1}]", 
        rit->first, rit->second); 
    return (0); 
    } 
 
  

需求

標頭: < cliext/地圖 >

Namespace: cliext

請參閱

參考

map (STL/CLR)

map::begin (STL/CLR)

map::end (STL/CLR)

map::rend (STL/CLR)