vendredi 11 septembre 2020

value_comp and * before a iterator

What does the value_comp do, like does it check the first value equal to the second?

and * operator before the iterator?

map<char, char> m = 
{
   { 'a', 'A' },
   { 'b', 'B' },
   { 'c', 'C' },
   { 'd', 'D' },
   { 'e', 'E' },
};

auto last = *m.rbegin(); // How does "*" affect the iterator returned
auto i = m.begin();

do 
{

   cout << i->first
      << " = "
      << i->second
      << endl;
} while (m.value_comp()(*i++, last));  
// Does the value_comp compares *i++ and the last value or iterator

Aucun commentaire:

Enregistrer un commentaire