foo.cc: In function 'void work()':
foo.cc:28:20: error: expected identifier before 'this'
28 | auto res = [&](this auto &&res, int l, int r, int p) -> int {
| ^~~~
foo.cc:28:20: error: expected ',' or '...' before 'this'
foo.cc: In lambda function:
foo.cc:29:13: error: 'l' was not declared in this scope
29 | if (l == r) return v[l];
| ^
foo.cc:29:18: error: 'r' was not declared in this scope
29 | if (l == r) return v[l];
| ^
foo.cc:30:20: error: 'l' was not declared in this scope
30 | int mid = (l+r)/2;
| ^
foo.cc:30:22: error: 'r' was not declared in this scope
30 | int mid = (l+r)/2;
| ^
foo.cc:31:13: error: 'p' was not declared in this scope
31 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^
foo.cc:31:27: error: use of 'res' before deduction of 'auto'
31 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:31:42: error: use of 'res' before deduction of 'auto'
31 | if (p) return max(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:32:25: error: use of 'res' before deduction of 'auto'
32 | else return min(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc:32:40: error: use of 'res' before deduction of 'auto'
32 | else return min(res(l,mid,!p), res(mid+1,r,!p));
| ^~~
foo.cc: In function 'void work()':
foo.cc:39:20: error: no match for call to '(work()::<lambda(int)>) (int, ll, ll&)'
39 | cout << res(0,n-1,p) << '\n';
| ~~~^~~~~~~~~
foo.cc:28:16: note: candidate: 'work()::<lambda(int)>'
28 | auto res = [&](this auto &&res, int l, int r, int p) -> int {
| ^
foo.cc:28:16: note: candidate expects 1 argument, 3 provided