ConflictBasedSearch icon indicating copy to clipboard operation
ConflictBasedSearch copied to clipboard

LowLevelSolver::findIndex(std::vector<Cell> cells, Cell cell)

Open Jpstraw opened this issue 3 years ago • 0 comments

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;

Jpstraw avatar Jul 05 '22 07:07 Jpstraw