Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of the Copy trait for K and V #18

Closed
yegor256 opened this issue Apr 18, 2023 · 3 comments
Closed

get rid of the Copy trait for K and V #18

yegor256 opened this issue Apr 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@yegor256
Copy link
Owner

Somehow Vec and HashMap work with keys and values that don't implement Copy. We should do the same. I'm not sure exactly how this can be done, but it should be possible.

@yegor256 yegor256 added the bug Something isn't working label Apr 18, 2023
@WiebeCnossen
Copy link
Contributor

I am not sure this would have great value for micromap: it is meant to use the stack whereas Vec and HashMap are intended to use the heap. Using micromap with types that do not implement Copy would probably be an unusual case.

Also depending on how far you want to take this issue (concretely: remove Clone as well), this would have an impact on the current API as e.g. .into_iter(&self) really cannot do without this.

@yegor256
Copy link
Owner Author

@WiebeCnossen I'm not really an expert in this area. Help me understand. Now, when we put a pair into the array, we do memcpy. If we use Clone, we will put pointers into our array? Is this your concern?

yegor256 added a commit that referenced this issue Apr 23, 2023
yegor256 added a commit that referenced this issue Apr 23, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
@yegor256
Copy link
Owner Author

we don't use Copy anymore

yegor256 added a commit that referenced this issue Apr 24, 2023
yegor256 added a commit that referenced this issue Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants