BAN: Remove unstable hash map and set

These can now be implemented safely with new linked list api
This commit is contained in:
2024-02-06 17:35:15 +02:00
parent 5da59c9151
commit 40e341b0ee
6 changed files with 90 additions and 110 deletions

View File

@@ -72,9 +72,9 @@ static constexpr Position s_dir_offset[] {
i64 solve_general(FILE* fp, auto parse_dir, auto parse_count)
{
BAN::HashSetUnstable<Position, PositionHash> path;
BAN::HashSetUnstable<Position, PositionHash> lpath;
BAN::HashSetUnstable<Position, PositionHash> rpath;
BAN::HashSet<Position, PositionHash> path;
BAN::HashSet<Position, PositionHash> lpath;
BAN::HashSet<Position, PositionHash> rpath;
Position current_pos { 0, 0 };
MUST(path.insert(current_pos));
@@ -157,8 +157,8 @@ i64 solve_general(FILE* fp, auto parse_dir, auto parse_count)
ASSERT(lmin_x != rmin_x);
auto& expand = (lmin_x < rmin_x) ? rpath : lpath;
BAN::HashSetUnstable<Position, PositionHash> visited;
BAN::HashSetUnstable<Position, PositionHash> inner_area;
BAN::HashSet<Position, PositionHash> visited;
BAN::HashSet<Position, PositionHash> inner_area;
while (!expand.empty())
{

View File

@@ -33,7 +33,7 @@ struct Rule
BAN::String target;
};
using Workflows = BAN::HashMapUnstable<BAN::String, BAN::Vector<Rule>>;
using Workflows = BAN::HashMap<BAN::String, BAN::Vector<Rule>>;
struct Item
{

View File

@@ -72,9 +72,9 @@ struct ConjunctionModule : public Module
}
};
BAN::HashMapUnstable<BAN::String, BAN::UniqPtr<Module>> parse_modules(FILE* fp)
BAN::HashMap<BAN::String, BAN::UniqPtr<Module>> parse_modules(FILE* fp)
{
BAN::HashMapUnstable<BAN::String, BAN::UniqPtr<Module>> modules;
BAN::HashMap<BAN::String, BAN::UniqPtr<Module>> modules;
char buffer[128];
while (fgets(buffer, sizeof(buffer), fp))

View File

@@ -88,13 +88,13 @@ i64 puzzle1(FILE* fp)
{
auto garden = parse_garden(fp);
BAN::HashSetUnstable<Position> visited, reachable, pending;
BAN::HashSet<Position> visited, reachable, pending;
MUST(pending.insert(garden.start));
for (i32 i = 0; i <= 64; i++)
{
auto temp = BAN::move(pending);
pending = BAN::HashSetUnstable<Position>();
pending = BAN::HashSet<Position>();
while (!temp.empty())
{