I have a project I'm working on from stanford's CS106B, which is boggle. I have a struct, dieLocation, which is supposed to represent the location of a die on my Boggle board.
typedef struct dieLocation {
int row, column;
}dieLocation;
I then have this code:
Set<dieLocation> Boggle::getUnmarkedNeighbors(Grid<bool> &markedLocations, dieLocation currentDie) {
int row = currentDie.row;
int column = currentDie.column;
Set<dieLocation> neighbors;
for(int currRow = row - 1; currRow < row + 1; currRow++) {
for(int currCol = column - 1; currCol < column + 1; currCol++) {
//if neighbor is in bounds, get its row and column.
if(markedLocations.inBounds(currRow, currCol)) {
//if neighbor is unmarked, add it to the neighbors set
if(markedLocations.get(currRow, currCol)) {
dieLocation neighbor;
neighbor.row = currRow;
neighbor.column = currCol;
neighbors.add(neighbor);
}
}
}
}
return neighbors;
}
I try to build this project in Qt Creator, but I keep receiving an error, which is: no match for 'operator<'(operand types are const dieLocation and const dieLocation)
What my code does, is it assigns the row and column of the passed dieLocation to their respective variables. it then loops through each row, starting from one less than the passed row, to one more the same goes for columns. however, I believe I am comparing integers in the for loop, but it says i'm comparing dieLocations? Does anyone understand why this happens?