#include <iostream>
#include <typeinfo>
using namespace std;
template <typename T>
class someContainer
{
private:
T val1;
T val2;
public:
someContainer(const T& in1, const T& in2)
:val1(in1), val2(in2) {}
template <typename Ret = bool ,typename Ty = T>
void sort(Ret (*_comp)(const Ty&, const Ty&))
{
cout << "Comp is of type: " << typeid(_comp).name() << endl;
cout << _comp(val1, val2) << endl;
return;
}
};
template <typename Ret, typename R>
Ret compare(const R& a, const R& b)
{
return a>b;
}
int main()
{
someContainer<int> myCont(7,6);
myCont.sort(compare);
cin.ignore();
return 0;
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgICNpbmNsdWRlIDx0eXBlaW5mbz4KICAgIHVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAgICAKICAgIHRlbXBsYXRlIDx0eXBlbmFtZSBUPgogICAgY2xhc3Mgc29tZUNvbnRhaW5lcgogICAgewogICAgcHJpdmF0ZToKICAgICAgICBUIHZhbDE7CiAgICAgICAgVCB2YWwyOwogICAgcHVibGljOgogICAgICAgIHNvbWVDb250YWluZXIoY29uc3QgVCYgaW4xLCBjb25zdCBUJiBpbjIpCiAgICAgICAgICAgIDp2YWwxKGluMSksIHZhbDIoaW4yKSB7fQogICAgCiAgICAgICAgdGVtcGxhdGUgPHR5cGVuYW1lIFJldCA9IGJvb2wgLHR5cGVuYW1lIFR5ID0gVD4KICAgICAgICB2b2lkIHNvcnQoUmV0ICgqX2NvbXApKGNvbnN0IFR5JiwgY29uc3QgVHkmKSkKICAgICAgICB7CiAgICAgICAgICAgIGNvdXQgPDwgIkNvbXAgaXMgb2YgdHlwZTogIiA8PCB0eXBlaWQoX2NvbXApLm5hbWUoKSA8PCBlbmRsOwogICAgICAgICAgICBjb3V0IDw8IF9jb21wKHZhbDEsIHZhbDIpIDw8IGVuZGw7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICB9OwogICAgCiAgICB0ZW1wbGF0ZSA8dHlwZW5hbWUgUmV0LCB0eXBlbmFtZSBSPgogICAgUmV0IGNvbXBhcmUoY29uc3QgUiYgYSwgY29uc3QgUiYgYikKICAgIHsKICAgICAgICByZXR1cm4gYT5iOwogICAgfQogICAgCiAgICBpbnQgbWFpbigpCiAgICB7CiAgICAgICAgc29tZUNvbnRhaW5lcjxpbnQ+IG15Q29udCg3LDYpOwogICAgICAgIG15Q29udC5zb3J0KGNvbXBhcmUpOyAKICAgIAogICAgICAgIGNpbi5pZ25vcmUoKTsKICAgICAgICByZXR1cm4gMDsKICAgIH0=