#include <vector>
#include <set>
#include <algorithm>
struct point // A simple custom point structure
{
int x, y;
};
int main()
{
// Lambda created by the wizard
// --------------------------------------------------
auto point_lambda = [] (const point &left, const point &right) -> bool
{
if (left.x == right.x)
return (left.y < right.y);
else
return (left.x < right.x);
};
// --------------------------------------------------
std::vector<point> v;
std::sort(v.begin(), v.end(), point_lambda); //Compiles happily with point structures
std::set<point, decltype(point_lambda)> s(point_lambda);
s.find(point()); //Compiles happily with point structures
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHNldD4KCiNpbmNsdWRlIDxhbGdvcml0aG0+CgpzdHJ1Y3QgcG9pbnQgLy8gQSBzaW1wbGUgY3VzdG9tIHBvaW50IHN0cnVjdHVyZQp7CiAgICBpbnQgeCwgeTsKfTsKCmludCBtYWluKCkKewoJLy8gTGFtYmRhIGNyZWF0ZWQgYnkgdGhlIHdpemFyZAoJLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCQoJYXV0byBwb2ludF9sYW1iZGEgPSBbXSAoY29uc3QgcG9pbnQgJmxlZnQsIGNvbnN0IHBvaW50ICZyaWdodCkgLT4gYm9vbAoJewoJCWlmIChsZWZ0LnggPT0gcmlnaHQueCkKCQkJcmV0dXJuIChsZWZ0LnkgPCByaWdodC55KTsKCQllbHNlCgkJCXJldHVybiAobGVmdC54IDwgcmlnaHQueCk7Cgl9OwoJCgkvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQoJCglzdGQ6OnZlY3Rvcjxwb2ludD4gdjsKCXN0ZDo6c29ydCh2LmJlZ2luKCksIHYuZW5kKCksIHBvaW50X2xhbWJkYSk7IC8vQ29tcGlsZXMgaGFwcGlseSB3aXRoIHBvaW50IHN0cnVjdHVyZXMKCQoJc3RkOjpzZXQ8cG9pbnQsIGRlY2x0eXBlKHBvaW50X2xhbWJkYSk+IHMocG9pbnRfbGFtYmRhKTsKCXMuZmluZChwb2ludCgpKTsgLy9Db21waWxlcyBoYXBwaWx5IHdpdGggcG9pbnQgc3RydWN0dXJlcwoJCglyZXR1cm4gMDsKfQ==