#include <iostream>
#include <algorithm>
#include<functional>
#include<vector>
using namespace std;
using namespace std::placeholders;
struct MyType
{
int _val;
MyType(int a) : _val(a){}
int val() const { return _val; }
};
int main()
{
vector<MyType> vec{ 1, 2, 4, 5 };
auto m = std::max_element(vec.begin(), vec.end(),
bind(less<int>(), bind(&MyType::val, _1), bind(&MyType::val, _2)));
std::cout << m->val() << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZTxmdW5jdGlvbmFsPgojaW5jbHVkZTx2ZWN0b3I+CgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdXNpbmcgbmFtZXNwYWNlIHN0ZDo6cGxhY2Vob2xkZXJzOwoKCnN0cnVjdCBNeVR5cGUKewoJaW50IF92YWw7CglNeVR5cGUoaW50IGEpIDogX3ZhbChhKXt9CglpbnQgdmFsKCkgY29uc3QgeyByZXR1cm4gX3ZhbDsgfQp9OwoKCmludCBtYWluKCkKewoJdmVjdG9yPE15VHlwZT4gdmVjeyAxLCAyLCA0LCA1IH07CgoJYXV0byBtID0gc3RkOjptYXhfZWxlbWVudCh2ZWMuYmVnaW4oKSwgdmVjLmVuZCgpLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmluZChsZXNzPGludD4oKSwgYmluZCgmTXlUeXBlOjp2YWwsIF8xKSwgYmluZCgmTXlUeXBlOjp2YWwsIF8yKSkpOwoKCXN0ZDo6Y291dCA8PCBtLT52YWwoKSA8PCBlbmRsOwoKCXJldHVybiAwOwp9