dlx: nicer iteration

This commit is contained in:
2022-11-20 11:15:15 -08:00
parent 50640e6adb
commit 234165c7f3
2 changed files with 99 additions and 56 deletions

View File

@@ -7,30 +7,9 @@
namespace dlx {
struct Cell;
class Dlx final {
struct Cell {
Cell *U, *D, *L, *R;
std::size_t n;
union {
Cell* c;
std::size_t s;
};
auto LR_self() -> void;
auto UD_self() -> void;
auto LR_delete() -> void;
auto UD_delete() -> void;
auto UD_restore() -> void;
auto LR_restore() -> void;
auto LR_insert(Cell* k) -> void;
auto UD_insert(Cell* k) -> void;
auto CoverCol() -> void;
auto UncoverCol() -> void;
auto ColAdd(std::size_t row_id) -> Cell*;
static Cell* ColNew();
};
std::vector<Cell*> ctab_;
std::vector<Cell*> rtab_;
Cell* root_;