set::rbegin (STL/CLR)

Designates the beginning of the reversed controlled sequence.

    reverse_iterator rbegin();

The member function returns a reverse iterator that designates the last element of the controlled sequence, or just beyond the beginning of an empty sequence. Hence, it designates the beginning of the reverse sequence. You use it to obtain an iterator that designates the current beginning of the controlled sequence seen in reverse order, but its status can change if the length of the controlled sequence changes.

// cliext_set_rbegin.cpp 
// compile with: /clr 
#include <cliext/set> 
typedef cliext::set<wchar_t> Myset; 
int main() 
    Myset c1; 
// display initial contents " a b c" 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
// inspect first two items in reversed sequence 
    Myset::reverse_iterator rit = c1.rbegin(); 
    System::Console::WriteLine("*rbegin() = {0}", *rit); 
    System::Console::WriteLine("*++rbegin() = {0}", *++rit); 
    return (0); 
 a b c
*rbegin() = c
*++rbegin() = b

Header: <cliext/set>

Namespace: cliext

Community Additions