Thinking of lambda expressions as 'syntactic sugar' for callable objects, can the unnamed underlying type be expressed?
An example:
struct gt {
bool operator() (int l, int r) {
return l > r;
}
} ;
Now, [](int l, int r) { return l > r; }
is an elegant replacement for the above code (plus the necessary creation of callable objects of gt), but is there a way to express gt (the type) itself?
A simple usage:
std::set<int, gt> s1; // A reversed-order std::set
// Is there a way to do the same using a lambda?
std::set<int, some-magic-here-maybe([](int l, int r) { return l > r; }) > s2;
operator<()
for my classes that needs to be sorted. that's why i didn't understand why lambda is required. – Ionogenstd::function
with the appropriate set of parameters. – Yonder