Unify ReadFieldNew / ReadFieldUpdate #31

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/genread changing 2 files +238 −254
  1. ryanofsky commented at 1:33 PM on March 20, 2020: collaborator

    Replace with ReadField wrapper and CustomReadField hook to be consistent with BuildField / CustomBuildField. This

    • Makes it more straightforward pass custom types with symmetric CustomReadField / CustomBuildField overloads

    • Simplifies debugging and overload resolution, removing hacks that allowed ReadFieldNew calls to forward to ReadFieldUpdate calls and vice versa

    • Enables more flexibility and efficiency within CustomReadField implementations allowing emplacing or updating in the same function based on which is simpler or more efficient. Removes a lot of std::enable_if overload hacks

    • Should allow clientInvoke to use RVO and construct return values in place instead of copying or moving. This will allow more types to be for supported as IPC return values even if they don't support default construction, copying, or moving.

    • Improves separation of concerns, avoids need for ReadField callers to know whether callee will emplace or update, avoids need for emplace ReadDest object to have hardcoded support for map, vector, optional, shared_ptr, reference_wrapper types, so they now are implemented the same as any other custom type.

  2. Unify ReadFieldNew / ReadFieldUpdate
    Replace with ReadField wrapper and CustomReadField hook to be consistent with
    BuildField / CustomBuildField. This
    
    - Makes it more straightforward pass custom types with symmetric
      CustomReadField / CustomBuildField overloads
    
    - Simplifies debugging and overload resolution, removing hacks that allowed
      ReadFieldNew calls to forward to ReadFieldUpdate calls and vice versa
    
    - Enables more flexibility and efficiency within CustomReadField
      implementations allowing emplacing or updating in the same function based on
      which is simpler or more efficient. Removes a lot of std::enable_if overload
      hacks
    
    - Should allow clientInvoke to use RVO and construct return values in place
      instead of copying or moving. This will allow more types to be for supported
      as IPC return values even if they don't support default construction,
      copying, or moving.
    
    - Improves separation of concerns, avoids need for ReadField callers to know
      whether callee will emplace or update, avoids need for emplace ReadDest
      object to have hardcoded support for map, vector, optional, shared_ptr,
      reference_wrapper types, so they now are implemented the same as any other
      custom type.
    112f364f01
  3. ryanofsky commented at 1:39 PM on March 20, 2020: collaborator
  4. ryanofsky merged this on Mar 20, 2020
  5. ryanofsky closed this on Mar 20, 2020

  6. ryanofsky referenced this in commit 65260d1851 on Jan 18, 2024
  7. ryanofsky referenced this in commit 7d1fee06d6 on Jan 18, 2024
  8. bitcoin-core locked this on Jun 25, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 13:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me