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

[FR] Add std::function::target() equivalent #67

Closed
psiha opened this issue Feb 27, 2024 · 1 comment
Closed

[FR] Add std::function::target() equivalent #67

psiha opened this issue Feb 27, 2024 · 1 comment

Comments

@psiha
Copy link

psiha commented Feb 27, 2024

...yet without a separate vtable call entry:

  • a void * returning version (the user has to know what is actually inside)
  • add a simple boolean to the vtable/meta object: specifying whether the assigned target is in the SBO (and so you return a pointer to the SBO) or on the heap (so you return the pointer stored at the begining of the SBO, I suppose)
    (and/or take into consideration [FR] SBO-only targets #66)
@mingxwa
Copy link
Collaborator

mingxwa commented Feb 29, 2024

a void * returning version (the user has to know what is actually inside)

Since most existing polymorphic wrappers in the standard do not support target(), there is no plan to add to proxy. On the other hand, with the current implementation of proxy, it is not trivial to dereference the target without a virtual dispatch.

add a simple boolean to the vtable/meta object

It can be done with reflection. Please refer to our unit tests as an example (exactly observes SBO).

@mingxwa mingxwa closed this as completed Mar 6, 2024
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

No branches or pull requests

2 participants