Skip to content

Two small additions to flat_hash_map#53

Open
jinxidoru wants to merge 1 commit intoskarupke:masterfrom
jinxidoru:master
Open

Two small additions to flat_hash_map#53
jinxidoru wants to merge 1 commit intoskarupke:masterfrom
jinxidoru:master

Conversation

@jinxidoru
Copy link
Copy Markdown

I recently encountered a problem in using flat_hash_map with really large data. I was surprised that the destructor was taking almost half a second to run. I realized it's because we were iterating over the entire table to destruct the entries, even though the entries were trivially destructible. This change will skip that last clear() call in the event that the destructors need not be run.

Secondly I added the contains() method since it was added to std::unordered_map<> with C++20.

- skip clear() when the value is trivially destructible
- added contains()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants