Skip to content

Improved CustomBuildField for std::optional in IPC/libmultiprocess#251

Open
mangoostaa wants to merge 1 commit intobitcoin-core:masterfrom
mangoostaa:feature/optional-forward
Open

Improved CustomBuildField for std::optional in IPC/libmultiprocess#251
mangoostaa wants to merge 1 commit intobitcoin-core:masterfrom
mangoostaa:feature/optional-forward

Conversation

@mangoostaa
Copy link

The function now uses std::forward(value) when building the field, so rvalues are forwarded correctly instead of always being treated as lvalues. This resolves the existing FIXME in that code path.

Details
Previously, the implementation forced every optional value to be accessed as an lvalue, which meant rvalues were unnecessarily copied. By applying perfect forwarding, the function now preserves the value category and allows moves where appropriate. The FIXME comment was removed since the intended behavior is now implemented

@DrahtBot
Copy link

DrahtBot commented Mar 11, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants