Add ReadList helper#285
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 ConflictsNo conflicts as of last run. |
| return *EmplacePiecewiseSafe(value, std::forward<decltype(args)>(args)...).first; | ||
| })); | ||
| } | ||
| ReadList( |
There was a problem hiding this comment.
In commit "proxy: add ReadList helper and dedup map/set/vector read handlers" (2bc6cb7)
Not sure if possible but it might be good to pass read_dest instead of value to the ReadList function so callers don't need to call read_dest.update and repeat as much code. This would make ReadList and BuildList more similar in how they are called. Looks like this would require adding auto& value parameters to init and emplace functions, which could also be good because it will declare value closer to where it is used.
There was a problem hiding this comment.
True, I will take a look on this approach
f2a734a to
245f792
Compare
|
Forced push 245f792 to just rebase with master |
245f792 to
5d23f83
Compare
|
Forced push 5d23f83 applying @ryanofsky suggestion. It reads cleaner and dedup more code. |
Follow up of #277 (review). This adds
ReadListhelper and uses it to dedup theCustomReadFieldimplementations forstd::map,std::set,std::unordered_set, andstd::vector, mirroring the existingBuildListhelper on the build side.I took the liberty of adding the commit f2a734a "type: reserve first when reading std::unordered_set" so it reserves the correct capacity first and then emplaces the values.