Skip to content

Add LinkedHashMap and unit tests.#1282

Merged
wujingyue merged 2 commits intomainfrom
wjy/map
Nov 13, 2023
Merged

Add LinkedHashMap and unit tests.#1282
wujingyue merged 2 commits intomainfrom
wjy/map

Conversation

@wujingyue
Copy link
Collaborator

This is separated from #1281 to keep the PR small.

@wujingyue
Copy link
Collaborator Author

!build

This is separated from #1281 to keep the PR small.
std::pair<V, typename LinkedHashMap<K, V>::const_iterator> LinkedHashMap<K, V>::
erase(const K& key) {
const_iterator index = key_to_index_.at(key);
return {index->second, order_.erase(index)};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also erase from key_to_index_?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Thanks for catching that.

@wujingyue wujingyue requested a review from zasdfgbnm November 13, 2023 15:30
@wujingyue wujingyue merged commit f8d8435 into main Nov 13, 2023
@wujingyue wujingyue deleted the wjy/map branch November 13, 2023 18:38
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