I have a vector of tuples like
vector> v;
I believe that when the default comparison kicks in for tuple types, i
You can do it like this
#include
#include
#include
#include
using namespace std;
vector> v;
int main() {
v.push_back(std::make_tuple(1,1.2,'c'));
v.push_back(std::make_tuple(1,1.9,'e'));
v.push_back(std::make_tuple(1,1.7,'d'));
sort(v.begin(),v.end(),
[](const tuple& a,
const tuple& b) -> bool
{
return std::get<1>(a) > std::get<1>(b);
});
cout << std::get<2>(v[0]) << endl;
return 0;
}