Add std::unordered_set support and a helper BuildList to dedup list build handlers#277
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
e1914bb to
5b9db34
Compare
5b9db34 to
00c9a8e
Compare
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 00c9a8e. This is a well-implemented change that simplifies bitcoin/bitcoin#29409, and could help other places, since unordered_sets are used for various things in bitcoin core, and it makes sense to allow them to be easily passed over capnproto interfaces.
I believe there could be more dedup adding a ReadList too. I could do that as a follow-up if desirable
Yes this would be a nice followup, especially since type-set.h and type-unordered-set.h files are almost exact duplicates of each other and other read functions are very similar. Might be possible to write a generic ReadList that works for all containers by taking an init(size) callback and an emplace(args...) callback.
|
The new optional_int field on master uses a proper camelCase capnp name (optionalInt) with $Proxy.name mapping to a snake_case C++ member, which reads cleaner than the older lowercase style (setint, vbool). Should I follow that pattern here and rename unorderedsetint to an unorderedSetInt capnp field with a snake_case C++ member? No need to touch the existing setint/vbool fields here. I believe that cleanup could be a separate PR. |
Anything seems fine to me, would choose whatever seems cleanest to you. Feel free to include a commit renaming existing fields in this PR too if you'd like |
00c9a8e to
81e508f
Compare
81e508f to
9de4b88
Compare
Add std::unordered_set support and a helper BuildList to dedup list build handlers that is being used for map, set and vector.
While looking bitcoin/bitcoin#29409, found a TODO noting that libmultiprocess lacked std::unordered_set support, requiring downstream that PR to implement the build/read functions locally.
I believe there could be more dedup adding a ReadList too. I could do that as a follow-up if desirable