~ttt/sudoku

b734461121dc49aed776cfc72e0abddd7f16bd87 — Tomasz Kłak 4 years ago 47fcedf master
Speedup .front with clt built in
1 files changed, 2 insertions(+), 7 deletions(-)

M main.cc
M main.cc => main.cc +2 -7
@@ 189,12 189,7 @@ struct PieceSet {
        }
    }
    Piece front() const {
        for (size_t i = 1; i != data_.size(); ++i) {
            if (data_[i]) {
                return i;
            }
        }
        std::abort();
        return __builtin_ctz(data_.to_ulong());
    }

private:


@@ 457,9 452,9 @@ struct Board {
                guesses.emplace_back(field.size(), Pos::fromIdx(i));
            }
        }
        assert(!guesses.empty());
        std::sort(guesses.begin(), guesses.end(),
            [](const auto& l, const auto& r) { return l.first < r.first; });
        assert(!guesses.empty());
        return guesses[0].second;
    }