Files
ladybird/Libraries/LibGC/HeapHashTable.h
Davi Gomes 6d77c9edd1 Libraries: Move #pragma once above include headers
The #pragma once was placed after the #include directives instead of
immediately after the copyright comment, inconsistent with every other
header file
2026-03-22 14:05:44 +01:00

41 lines
778 B
C++

/*
* Copyright (c) 2026, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashTable.h>
#include <LibGC/Cell.h>
#include <LibGC/CellAllocator.h>
namespace GC {
template<typename T>
class HeapHashTable : public Cell {
GC_CELL(HeapHashTable, Cell);
GC_DECLARE_ALLOCATOR(HeapHashTable);
public:
HeapHashTable() = default;
virtual ~HeapHashTable() override = default;
auto& table() { return m_table; }
auto const& table() const { return m_table; }
virtual void visit_edges(Visitor& visitor) override
{
Base::visit_edges(visitor);
visitor.visit(m_table);
}
private:
HashTable<T> m_table;
};
template<typename T>
GC_DEFINE_ALLOCATOR(HeapHashTable<T>);
}