-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Add values() functions to EnumerableSets #2768
Add values() functions to EnumerableSets #2768
Conversation
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { | ||
return set._inner._values; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that returning a memory
array implies reading the entire thing from storage and copying it - not sure if that was the original intent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, shouldn't this be implemented for Set
as Set._values()
, and call that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning a storage pointer will potentially encourage the users to write/modify it, which would break the structure. We really want to avoid this.
Address request from #2390
PR Checklist