Skip to content

Conversation

@matthyx
Copy link
Contributor

@matthyx matthyx commented Oct 29, 2024

This is useful for SafeMap where you cannot Lock() to perform Get() and Delete() atomically.

@spekary
Copy link
Contributor

spekary commented Nov 5, 2024

I think this is a great idea. Looking through the code, I don't see anything wrong with changing the interface for Delete to also return the value. That shouldn't break any current code, and it just adds a map lookup to Delete in all the versions, so it shouldn't significantly impact performance. Do you think you could change your code to just have Delete return the value, instead of adding another function?

@matthyx
Copy link
Contributor Author

matthyx commented Nov 5, 2024

Sure I'll update it tomorrow!

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
@matthyx matthyx changed the title add Pop method to return deleted value modify Delete method to return deleted value Nov 8, 2024
@matthyx
Copy link
Contributor Author

matthyx commented Nov 8, 2024

@spekary done!

@spekary spekary merged commit 98d8666 into goradd:main Nov 9, 2024
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