I am making a sudoku game in C++ to improve and learn SFML more thoughtfully, but I have run into a problem with range based loops.
I have an array of Tables like this:
Table Tables[9];
and when I loop through them like so:
for(auto table: Tables){
//do stuff
}
There is no problem. Every table has an array of sub-fields, like so
Field fields[9];
which are supposed to be accessed with getter
Field *Table::getFields() {
return fields;
}
But when I try to go through it all with
for(auto table: Tables){
for(auto field: table.getFields()) {
//do stuff
}
}
I get an error "Field *" is not a valid range type. How do I return the array so it's loop-able?
Also: I have tested Tables[i].getFields()[f].doStuff
and it work just fine, so I believe the array is returned.