Skip to content

Conversation

@ryanofsky
Copy link
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.

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.
@ryanofsky
Copy link
Collaborator Author

Corresponding updates for bitcoin were ryanofsky/bitcoin@cc91cff

@ryanofsky ryanofsky merged commit 78f2f75 into bitcoin-core:master Mar 20, 2020
ryanofsky added a commit to ryanofsky/libmultiprocess that referenced this pull request Jan 18, 2024
Last remaining uses of these utilities except for ThrowFn were removed in PR
"Unify ReadFieldNew / ReadFieldUpdate"
bitcoin-core#31

Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced
with a perfect-forwarding auto&& lambda.

Immediate motivation for this change is to fix C++20 compilers complaining about
reference to std::result_of in the unused code
bitcoin/bitcoin#29248
ryanofsky added a commit that referenced this pull request Jan 18, 2024
…helpers

65260d1 util: Drop Bind, BindTuple, ComposeFn, GetFn, and ThrowFn helpers (Ryan Ofsky)

Pull request description:

  Last remaining uses of these utilities except for ThrowFn were removed in #31.

  Last remaining use of ThrowFn is removed here. After C++14 it is easily replaced with a perfect-forwarding auto&& lambda.

  Immediate motivation for this change is to fix C++20 compilers complaining about reference to std::result_of in the unused code:
  bitcoin/bitcoin#29248

Top commit has no ACKs.

Tree-SHA512: ecf60074101c04102e1119f08b7201fc81640a63eb7590db93a77af7be7ff80af5262190fe2ba87ce00c5638323ee863f2852942b91fd51d06d35079a00d122d
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jun 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant