Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Single lookup for try_emplace and insert_or_assign #116

Merged
merged 1 commit into from
Mar 14, 2021

Conversation

martinus
Copy link
Owner

@martinus martinus commented Mar 14, 2021

Found by @GilesBathgate who provided a POC in #114. Thanks!

Now try_emplace and isnert_or_assign don't require two lookups.

This implementation reuses the same insertion code for insert() and emplace().
Also fixes a bug for emplace() where a node was not destroyed when overflow
exception occured.

@martinus martinus force-pushed the 2021-03-try_emplace_simplification branch 3 times, most recently from a07dd77 to 89cce8d Compare March 14, 2021 12:08
Found by @GilesBathgate who provided a POC in #114. Thanks!

Now try_emplace and isnert_or_assign don't require two lookups.

This implementation reuses the same insertion code for insert() and emplace().
Also fixes a bug for emplace() where a node was not destroyed when overflow
exception occured.
@martinus martinus force-pushed the 2021-03-try_emplace_simplification branch from 89cce8d to 8e68f12 Compare March 14, 2021 12:11
@martinus martinus merged commit a8f297b into master Mar 14, 2021
@martinus martinus deleted the 2021-03-try_emplace_simplification branch March 14, 2021 15:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant