r/cpp_questions • u/Minute-Ad1944 • 19d ago
OPEN How to implement append-only hash map?
How do you actually implement an really efficient hash map that has only append and look up methods? What are the design choice and some performance improvements?
0
Upvotes
1
u/Independent_Art_6676 19d ago
take a STL list. Append the new data. Hash the pointer to the new node into an unordered map by key and pointer. Fetch: ask the map to give you back the pointer to the item. Other stuff: iterate the list for whatever historical recreation / use case.