MCPcopy Create free account
hub / github.com/0voice/cpp_new_features / main

Function main

cpp_14/001_stl_crbegin.cpp:4–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int main()
5{
6
7 // initialize container
8 map<int, int> mp;
9
10 // insert elements in random order
11 mp.insert({ 2, 30 });
12 mp.insert({ 1, 40 });
13 mp.insert({ 3, 60 });
14 mp.insert({ 4, 20 });
15 mp.insert({ 5, 50 });
16
17 // prints the elements
18 cout << "\nThe map in reverse order is:\n";
19 cout << "KEY\tELEMENT\n";
20 for (auto itr = mp.crbegin(); itr != mp.crend(); ++itr) {
21 cout << itr->first
22 << '\t' << itr->second << '\n';
23 }
24 return 0;
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected