Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement indirection syntax #121

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

mingxwa
Copy link
Collaborator

@mingxwa mingxwa commented Jun 20, 2024

Changes

  • Whether a dispatch type D applies to a pointer, or the target of a pointer, is now determined by D::is_direct (required to be provided as static constexpr bool). In the previous design, this was determined by overload resolution, which makes the semantics ambiguous.
  • Similar with dispatch, a reflection type R also requires R::is_direct to be provided as static constexpr bool.
  • The direct and indirect accessors are split. Direct accessors are inherited by a proxy, while indirect accessors are available via proxy::operator-> or proxy::operator*.
  • Added another 12 macros to define direct or indirect dispatch types, while the previous ones (like PRO_DEF_MEM_DISPATCH) defaults to indirect:
#define PRO_DEF_INDIRECT_MEM_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_MEM_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_INDIRECT_FREE_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_FREE_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_INDIRECT_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_INDIRECT_PREFIX_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_PREFIX_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_INDIRECT_POSTFIX_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_POSTFIX_OPERATOR_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_INDIRECT_CONVERSION_DISPATCH(__NAME, ...) // See proxy.h
#define PRO_DEF_DIRECT_CONVERSION_DISPATCH(__NAME, ...) // See proxy.h
  • Updated unit tests and README accordingly.

@mingxwa mingxwa added this to the P3086R3 milestone Jun 20, 2024
@mingxwa mingxwa requested review from tian-lt and guominrui June 20, 2024 02:30
@mingxwa mingxwa self-assigned this Jun 20, 2024
@mingxwa mingxwa merged commit ab17914 into microsoft:main Jun 24, 2024
4 checks passed
@mingxwa mingxwa deleted the user/mingxwa/indirection branch June 24, 2024 07:37
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