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

Remove constraints on class template proxy and optimize memory layout for small VTABLE #70

Merged
merged 9 commits into from
Mar 5, 2024

Conversation

mingxwa
Copy link
Collaborator

@mingxwa mingxwa commented Mar 2, 2024

When a VTABLE only contains 2 function pointers or less, it is not necessary to dereference through a pointer. This change allows a VTABLE to be embedded into a proxy if small enough. The constraints on class template proxy (basic_facade) has been removed since this optimization needs all the dispatches to be complete types before proxy is instantiated, while proxy<F> is allowed to be incomplete in the definition of a dispatch.

This change also improves proxiable and corresponding helper macros. When the return type of an instantiated operator() of a dispatch D does not match the return type defined in the specific overload of D::overload_types, proxiable used to produce a compile error. The behavior has become SFINAE-safe after this change.

Resolves #69
Resolves #65

proxy.h Outdated Show resolved Hide resolved
proxy.h Outdated Show resolved Hide resolved
@mingxwa mingxwa merged commit 90c9db6 into microsoft:main Mar 5, 2024
4 checks passed
@mingxwa mingxwa deleted the user/mingxwa/sbo branch April 1, 2024 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants