ConflictBasedSearch
ConflictBasedSearch copied to clipboard
LowLevelSolver::findIndex(std::vector<Cell> cells, Cell cell)
Original code:
inline int LowLevelSolver::findIndex(std::vector<Cell> cells, Cell cell) {
// BURADA CELLI KARSILASTIRMADA HATA VAR
auto it = std::find(cells.begin(), cells.end(), cell);
return it != cells.end();
}
Modified code
inline int LowLevelSolver::findIndex(std::vector<Cell> cells, Cell cell) {
// BURADA CELLI KARSILASTIRMADA HATA VAR
auto it = std::find(cells.begin(), cells.end(), cell);
if (cells.size() >= 0) {
std::vector<Cell>::iterator it0 = find(cells.begin(), cells.end(), cells[0]);
std::vector<Cell>::iterator it = find(cells.begin(), cells.end(), cell);
return it - it0;
}
return -1;