foo.cc: In function ‘int main()’:
foo.cc:10:20: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
10 | auto read = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^~~~
foo.cc:10:32: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
10 | auto read = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^~~~
foo.cc: In lambda function:
foo.cc:13:27: error: invalid types ‘int[int]’ for array subscript
13 | cin >> mat[i][j];
| ^
foo.cc:14:21: error: expression cannot be used as a function
14 | self(self, mat, rows, cols, i, j + 1);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:16:21: error: expression cannot be used as a function
16 | self(self, mat, rows, cols, i + 1, 0);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc: In function ‘int main()’:
foo.cc:21:9: error: no match for call to ‘(main()::<lambda(int&, int&, int, int, int, int)>) (main()::<lambda(int&, int&, int, int, int, int)>&, std::vector<std::vector<int> >&, int&, int&)’
21 | read(read, A, m, n);
| ~~~~^~~~~~~~~~~~~~~
foo.cc:21:9: note: candidate: ‘void (*)(int&, int&, int, int, int, int)’ (conversion)
foo.cc:21:9: note: candidate expects 7 arguments, 5 provided
foo.cc:10:17: note: candidate: ‘main()::<lambda(int&, int&, int, int, int, int)>’
10 | auto read = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^
foo.cc:10:17: note: no known conversion for argument 2 from ‘std::vector<std::vector<int> >’ to ‘int&’
foo.cc:22:9: error: no match for call to ‘(main()::<lambda(int&, int&, int, int, int, int)>) (main()::<lambda(int&, int&, int, int, int, int)>&, std::vector<std::vector<int> >&, int&, int&)’
22 | read(read, B, n, p);
| ~~~~^~~~~~~~~~~~~~~
foo.cc:22:9: note: candidate: ‘void (*)(int&, int&, int, int, int, int)’ (conversion)
foo.cc:22:9: note: candidate expects 7 arguments, 5 provided
foo.cc:10:17: note: candidate: ‘main()::<lambda(int&, int&, int, int, int, int)>’
10 | auto read = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^
foo.cc:10:17: note: no known conversion for argument 2 from ‘std::vector<std::vector<int> >’ to ‘int&’
foo.cc:29:21: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
29 | auto print = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^~~~
foo.cc:29:33: error: use of ‘auto’ in lambda parameter declaration only available with ‘-std=c++14’ or ‘-std=gnu++14’
29 | auto print = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^~~~
foo.cc: In lambda function:
foo.cc:32:28: error: invalid types ‘int[int]’ for array subscript
32 | cout << mat[i][j] << (j < cols - 1 ? " " : "\n");
| ^
foo.cc:33:21: error: expression cannot be used as a function
33 | self(self, mat, rows, cols, i, j + 1);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc:35:21: error: expression cannot be used as a function
35 | self(self, mat, rows, cols, i + 1, 0);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.cc: In function ‘int main()’:
foo.cc:40:10: error: no match for call to ‘(main()::<lambda(int&, int&, int, int, int, int)>) (main()::<lambda(int&, int&, int, int, int, int)>&, std::vector<std::vector<int> >&, int&, int&)’
40 | print(print, C, m, p);
| ~~~~~^~~~~~~~~~~~~~~~
foo.cc:40:10: note: candidate: ‘void (*)(int&, int&, int, int, int, int)’ (conversion)
foo.cc:40:10: note: candidate expects 7 arguments, 5 provided
foo.cc:29:18: note: candidate: ‘main()::<lambda(int&, int&, int, int, int, int)>’
29 | auto print = [](auto& self, auto& mat, int rows, int cols, int i = 0, int j = 0) {
| ^
foo.cc:29:18: note: no known conversion for argument 2 from ‘std::vector<std::vector<int> >’ to ‘int&’