Feature: Support overloads in dispatch definition #45
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.
Overloading is a widely used paradigm that helps reducing the effort of naming of abstraction. However, it is not supported in the existing implementation of
proxy
. This PR aims to add this capability inspired by #43. After this change, overloading with different signatures becomes available in a single dispatch. Anoperator()
was also added toproxy
to simplify the invocation syntax when only onedispatch
is specified. Unit test cases are updated accordingly to cover this change. Documentations will be updated later.BREAKING CHANGE:
pro::dispatch
no longer supports adaption with CPO. This feature has been moved to another class templatepro::dispatch_adaptor
.pro::dispatch<std::size_t(), std::ranges::size>
was a valid type before this change but not anymore. The equivalent type has becomepro::dispatch_adaptor<std::ranges::size, std::size_t()>
with this change.The syntax to define a dispatch with single overload is the same as before:
The syntax to define a dispatch with multiple overloads is similar:
See the updated unit test cases for more details.