This repository was archived by the owner on Jan 29, 2026. It is now read-only.
Move direction semantics from dispatches to conventions#125
Merged
tian-lt merged 4 commits intomicrosoft:mainfrom Jul 3, 2024
Merged
Move direction semantics from dispatches to conventions#125tian-lt merged 4 commits intomicrosoft:mainfrom
tian-lt merged 4 commits intomicrosoft:mainfrom
Conversation
tian-lt
reviewed
Jul 2, 2024
guominrui
previously approved these changes
Jul 2, 2024
tian-lt
reviewed
Jul 2, 2024
tian-lt
approved these changes
Jul 3, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Dereferencing a pointer with
std::to_address()is feasible, but throws away cv-ref qualifiers. It is acceptable in many cases, but has certain limitations comparing tostd::move_only_function(C++23) andstd::copyable_function(C++26). Therefore, we have made a major decision to switch fromstd::to_address()tooperator*when dereferencing a pointer that is potentially qualified. Consequently, we also decided to remove the direction semantics in reflection types (added in #121) because the result type ofoperator*relies on the qualifier of a pointer.Changes
concept facade.static constexpr bool is_directfrom dispatch types to convention types.proxy_invokefrom the combination of dispatch and overload types into one convention type.access_proxyfrom an instantiation ofproxyinto one facade type.operator*toproxy.operator*to the 3 pointer implementations:inplace_ptr,allocated_ptrandcompact_ptr.facade_builder:add_indirect_conventionandadd_direct_convention. The existingadd_conventionis equivalent toadd_indirect_convention.DIRECTandINDIRECTmacros of dispatch definition introduced in Implement indirection syntax #121, specifically:PRO_DEF_INDIRECT_MEM_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_MEM_DISPATCH(__NAME, ...) PRO_DEF_INDIRECT_FREE_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_FREE_DISPATCH(__NAME, ...) PRO_DEF_INDIRECT_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_INDIRECT_PREFIX_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_PREFIX_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_INDIRECT_POSTFIX_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_POSTFIX_OPERATOR_DISPATCH(__NAME, ...) PRO_DEF_INDIRECT_CONVERSION_DISPATCH(__NAME, ...) PRO_DEF_DIRECT_CONVERSION_DISPATCH(__NAME, ...)