#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;

bool operator<(
	const tuple<int, int>& t1,
	const tuple<int, int>& t2
) {
	return get<1>(t1) > get<1>(t2);// `>` so that it gets sorted in reverse
}

int main() {
	vector<tuple<int, int>> v;
	for (int i = 0; i < 10; ++i) {
		v.push_back(make_tuple(0, i));
	}
	cout << "before sort: ";
	for (auto& x : v) { cout << get<1>(x) << ", "; }
	cout << endl;
	
	auto v2 = v;
	sort(v2.begin(), v2.end());
	cout << "after sort(begin, end): ";
	for (auto& x : v2) { cout << get<1>(x) << ", "; }
	cout << endl;
	
	sort(v.begin(), v.end(), [](auto& t1, auto& t2) {
		return get<1>(t1) > get<1>(t2);// `>` so that it gets sorted in reverse
	});
	cout << "after sort(begin, end, comparator): ";
	for (auto& x : v) { cout << get<1>(x) << ", "; }
	cout << endl;
	
	return 0;
}