I'm working on a recursive function that has a class as an argument:
Code:
board_t solve(board_t board, int x, int *rowtarget, int* coltarget) {
int i;
board_t temp = board;
for (i = 0; i < board.size; ++i) {
temp.board[x][i] = true;
if (ok(temp,rowtarget,coltarget)) {
if (x < board.size - 1)
return solve(temp,x+1,rowtarget,coltarget);
else
return temp;
}
temp = board;
}
printf("no solutions found!\n");
return board;
}
so I implemented a copy constructor and operator= for the class. Now when I compile my code I get the following error on the line where the recursive function calls itself:
error: no matching function for call to `board_t::board_t(board_t)'
board.h:9: note: candidates are: board_t::board_t(board_t&)
board.h:8: note: board_t::board_t(int)
I tried just making a duplicate of my copy constructor like that, but it gave me wicked errors. I'm not sure what's causing this, but I've tried everything I can think of and nothing works.