How to sort vector<int> v{3,2,7,6,5,8,1,2,3,4,5}; in decreasing order using function object.
I did using lambda expression
sort(v.begin(),v.end(),[](int a , int b){return a > b;});

But How we do using fn object

Here is a basic function object:

struct greater_than {
  bool operator()(int a, int b) const {
    return a > b;

and the sort call just becomes:

sort(v.begin(), v.end(), greater_than());

where greater_than() just creates the function object that is passed to the sort function.