vector<int> a = { 1,2,3,4,5,6,7 };
pair<vector<int>, vector<int>::iterator> pair_of_itr; //not working showing wrong directional error!
auto pair_of_itr = minmax_element(a.begin(), a.end());
cout << *pair_of_itr.first << " " << *pair_of_itr.second << endl; // working with auto but not with the PAIR of iterator.
//cout << pair_of_itr->first << " " << pair_of_itr->second << endl // not working
return 0;
Hier habe ich über Kommentare erklärt. Bitte verweise auf Kommentare.Was ist der Unterschied zwischen * iter.first und iter-> first?
Haben Sie sich den Typ von ['minmax_element'] angesehen (http://en.cppreference.com/w/cpp/algorithm/minmax_element)? – molbdnilo