Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

 

History

History
29 lines (20 loc) · 567 Bytes

rbegin.md

File metadata and controls

29 lines (20 loc) · 567 Bytes

rbegin

Description : This method returns an iterator pointing to the last element in the set.

Example :

#include<iostream>
#include<set>

int main() {
    // Create a set object holding integers
    std::set<int> s{ 14, 12, 15, 11, 10 };
  
    std::set<int>::reverse_iterator rit = s.rbegin(); 
  
    // prints all elements in reverse order
    for (; rit != s.rend(); ++rit) {
    	std::cout << *rit <<std::endl; 
    }
    
    return 0; 
} 

See Sample code Run Code